From bf479b49565d9b2ad2f66139cfa902aab59dbacf Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 8 Dec 2023 16:06:22 -0800 Subject: [PATCH 01/47] Bump TypeScript to `~5.0.4` --- package.json | 2 +- packages/accounts-controller/package.json | 2 +- packages/address-book-controller/package.json | 2 +- packages/announcement-controller/package.json | 2 +- packages/approval-controller/package.json | 2 +- packages/assets-controllers/package.json | 2 +- packages/base-controller/package.json | 2 +- packages/build-utils/package.json | 2 +- packages/composable-controller/package.json | 2 +- packages/controller-utils/package.json | 2 +- packages/ens-controller/package.json | 2 +- packages/eth-json-rpc-provider/package.json | 2 +- packages/gas-fee-controller/package.json | 2 +- packages/json-rpc-engine/package.json | 2 +- .../json-rpc-middleware-stream/package.json | 2 +- packages/keyring-controller/package.json | 2 +- packages/logging-controller/package.json | 2 +- packages/message-manager/package.json | 2 +- packages/name-controller/package.json | 2 +- packages/network-controller/package.json | 2 +- packages/notification-controller/package.json | 2 +- packages/permission-controller/package.json | 2 +- .../permission-log-controller/package.json | 2 +- packages/phishing-controller/package.json | 2 +- packages/polling-controller/package.json | 2 +- packages/preferences-controller/package.json | 2 +- .../queued-request-controller/package.json | 2 +- packages/rate-limit-controller/package.json | 2 +- .../selected-network-controller/package.json | 2 +- packages/signature-controller/package.json | 2 +- packages/transaction-controller/package.json | 2 +- .../user-operation-controller/package.json | 2 +- yarn.lock | 84 ++++++++++++------- 33 files changed, 84 insertions(+), 64 deletions(-) diff --git a/package.json b/package.json index cc07cfabb7..d942ea1f4b 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "simple-git-hooks": "^2.8.0", "ts-node": "^10.9.1", "tsup": "^8.0.2", - "typescript": "~4.9.5", + "typescript": "~5.0.4", "yargs": "^17.7.2" }, "packageManager": "yarn@3.3.0", diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index fd19882967..e7d1a3d19d 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -63,7 +63,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/keyring-controller": "^17.0.0", diff --git a/packages/address-book-controller/package.json b/packages/address-book-controller/package.json index 262ef3af82..da881c5e3d 100644 --- a/packages/address-book-controller/package.json +++ b/packages/address-book-controller/package.json @@ -53,7 +53,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/announcement-controller/package.json b/packages/announcement-controller/package.json index 8f5aee8e45..4168b2af53 100644 --- a/packages/announcement-controller/package.json +++ b/packages/announcement-controller/package.json @@ -51,7 +51,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/approval-controller/package.json b/packages/approval-controller/package.json index f8f6e61aea..3675c18f06 100644 --- a/packages/approval-controller/package.json +++ b/packages/approval-controller/package.json @@ -55,7 +55,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index c9fc5852c4..38aac99c45 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -85,7 +85,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/accounts-controller": "^17.0.0", diff --git a/packages/base-controller/package.json b/packages/base-controller/package.json index 8cb9641134..650555bc58 100644 --- a/packages/base-controller/package.json +++ b/packages/base-controller/package.json @@ -53,7 +53,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/build-utils/package.json b/packages/build-utils/package.json index 29b7eec38e..6e0489ff05 100644 --- a/packages/build-utils/package.json +++ b/packages/build-utils/package.json @@ -53,7 +53,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/composable-controller/package.json b/packages/composable-controller/package.json index 9865ba373a..dc530c3510 100644 --- a/packages/composable-controller/package.json +++ b/packages/composable-controller/package.json @@ -54,7 +54,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/controller-utils/package.json b/packages/controller-utils/package.json index 893a4bd1f3..ac96d8c739 100644 --- a/packages/controller-utils/package.json +++ b/packages/controller-utils/package.json @@ -60,7 +60,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/ens-controller/package.json b/packages/ens-controller/package.json index 1bc1316b78..c193ef1a56 100644 --- a/packages/ens-controller/package.json +++ b/packages/ens-controller/package.json @@ -56,7 +56,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/network-controller": "^19.0.0" diff --git a/packages/eth-json-rpc-provider/package.json b/packages/eth-json-rpc-provider/package.json index 8f70b98191..0f283cc453 100644 --- a/packages/eth-json-rpc-provider/package.json +++ b/packages/eth-json-rpc-provider/package.json @@ -58,7 +58,7 @@ "jest-it-up": "^2.0.2", "ts-jest": "^27.1.4", "typedoc": "^0.24.8", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "packageManager": "yarn@3.3.0", "engines": { diff --git a/packages/gas-fee-controller/package.json b/packages/gas-fee-controller/package.json index d72cc271f7..9852fe568a 100644 --- a/packages/gas-fee-controller/package.json +++ b/packages/gas-fee-controller/package.json @@ -65,7 +65,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/network-controller": "^19.0.0" diff --git a/packages/json-rpc-engine/package.json b/packages/json-rpc-engine/package.json index f306669f9a..618b50f414 100644 --- a/packages/json-rpc-engine/package.json +++ b/packages/json-rpc-engine/package.json @@ -63,7 +63,7 @@ "jest-it-up": "^2.0.2", "ts-jest": "^27.1.4", "typedoc": "^0.24.8", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "packageManager": "yarn@3.3.0", "engines": { diff --git a/packages/json-rpc-middleware-stream/package.json b/packages/json-rpc-middleware-stream/package.json index 88d92353c6..cb1a6871c3 100644 --- a/packages/json-rpc-middleware-stream/package.json +++ b/packages/json-rpc-middleware-stream/package.json @@ -57,7 +57,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5", + "typescript": "~5.0.4", "webextension-polyfill-ts": "^0.26.0" }, "engines": { diff --git a/packages/keyring-controller/package.json b/packages/keyring-controller/package.json index 88dc40a577..d7e64d789e 100644 --- a/packages/keyring-controller/package.json +++ b/packages/keyring-controller/package.json @@ -70,7 +70,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5", + "typescript": "~5.0.4", "uuid": "^8.3.2" }, "engines": { diff --git a/packages/logging-controller/package.json b/packages/logging-controller/package.json index 5abe098c4f..332b953c68 100644 --- a/packages/logging-controller/package.json +++ b/packages/logging-controller/package.json @@ -53,7 +53,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/message-manager/package.json b/packages/message-manager/package.json index efbffd04d7..99929a2c4e 100644 --- a/packages/message-manager/package.json +++ b/packages/message-manager/package.json @@ -57,7 +57,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/name-controller/package.json b/packages/name-controller/package.json index 01fe50988e..8408aaebca 100644 --- a/packages/name-controller/package.json +++ b/packages/name-controller/package.json @@ -55,7 +55,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/network-controller/package.json b/packages/network-controller/package.json index c33d1e7540..78b2ffc55b 100644 --- a/packages/network-controller/package.json +++ b/packages/network-controller/package.json @@ -71,7 +71,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json index a95c51a01b..b83fde2a44 100644 --- a/packages/notification-controller/package.json +++ b/packages/notification-controller/package.json @@ -53,7 +53,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/permission-controller/package.json b/packages/permission-controller/package.json index eaff8633b6..f9e1ca8c1c 100644 --- a/packages/permission-controller/package.json +++ b/packages/permission-controller/package.json @@ -60,7 +60,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/approval-controller": "^7.0.0" diff --git a/packages/permission-log-controller/package.json b/packages/permission-log-controller/package.json index 7310111406..2042c983c8 100644 --- a/packages/permission-log-controller/package.json +++ b/packages/permission-log-controller/package.json @@ -56,7 +56,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/phishing-controller/package.json b/packages/phishing-controller/package.json index 843fb31d19..ce6fe07c9c 100644 --- a/packages/phishing-controller/package.json +++ b/packages/phishing-controller/package.json @@ -58,7 +58,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/polling-controller/package.json b/packages/polling-controller/package.json index 7e312b70a0..257f361669 100644 --- a/packages/polling-controller/package.json +++ b/packages/polling-controller/package.json @@ -58,7 +58,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/network-controller": "^19.0.0" diff --git a/packages/preferences-controller/package.json b/packages/preferences-controller/package.json index 8465f6c9a4..bf6effcdd0 100644 --- a/packages/preferences-controller/package.json +++ b/packages/preferences-controller/package.json @@ -54,7 +54,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/keyring-controller": "^17.0.0" diff --git a/packages/queued-request-controller/package.json b/packages/queued-request-controller/package.json index e97e6da4a8..c41e6099b5 100644 --- a/packages/queued-request-controller/package.json +++ b/packages/queued-request-controller/package.json @@ -62,7 +62,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/network-controller": "^19.0.0", diff --git a/packages/rate-limit-controller/package.json b/packages/rate-limit-controller/package.json index 3d7e697610..4fc72c8f7a 100644 --- a/packages/rate-limit-controller/package.json +++ b/packages/rate-limit-controller/package.json @@ -53,7 +53,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/selected-network-controller/package.json b/packages/selected-network-controller/package.json index f006349159..92bffa4948 100644 --- a/packages/selected-network-controller/package.json +++ b/packages/selected-network-controller/package.json @@ -60,7 +60,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/network-controller": "^19.0.0", diff --git a/packages/signature-controller/package.json b/packages/signature-controller/package.json index 245b89d31f..53be528e05 100644 --- a/packages/signature-controller/package.json +++ b/packages/signature-controller/package.json @@ -59,7 +59,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/approval-controller": "^7.0.0", diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index dadf7c312e..76704af672 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -82,7 +82,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@babel/runtime": "^7.23.9", diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index d9b2d23f2f..7b3aca7c13 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -67,7 +67,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/approval-controller": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 6b07aff048..23966a337f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2218,7 +2218,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@metamask/keyring-controller": ^17.0.0 @@ -2251,7 +2251,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2267,7 +2267,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2287,7 +2287,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2348,7 +2348,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@metamask/accounts-controller": ^17.0.0 @@ -2404,7 +2404,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2441,7 +2441,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2494,7 +2494,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2526,7 +2526,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2590,7 +2590,7 @@ __metadata: simple-git-hooks: ^2.8.0 ts-node: ^10.9.1 tsup: ^8.0.2 - typescript: ~4.9.5 + typescript: ~5.0.4 yargs: ^17.7.2 languageName: unknown linkType: soft @@ -2634,7 +2634,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/network-controller": ^19.0.0 languageName: unknown @@ -2760,7 +2760,7 @@ __metadata: jest-it-up: ^2.0.2 ts-jest: ^27.1.4 typedoc: ^0.24.8 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -2965,7 +2965,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@metamask/network-controller": ^19.0.0 @@ -2987,7 +2987,7 @@ __metadata: jest-it-up: ^2.0.2 ts-jest: ^27.1.4 typedoc: ^0.24.8 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -3043,7 +3043,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 webextension-polyfill-ts: ^0.26.0 languageName: unknown linkType: soft @@ -3108,7 +3108,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -3126,7 +3126,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -3148,7 +3148,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -3175,7 +3175,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -3210,7 +3210,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -3241,7 +3241,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -3328,7 +3328,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/approval-controller": ^7.0.0 languageName: unknown @@ -3370,7 +3370,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -3406,7 +3406,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -3428,7 +3428,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@metamask/network-controller": ^19.0.0 @@ -3460,7 +3460,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/keyring-controller": ^17.0.0 languageName: unknown @@ -3540,7 +3540,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/network-controller": ^19.0.0 "@metamask/selected-network-controller": ^15.0.0 @@ -3561,7 +3561,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 languageName: unknown linkType: soft @@ -3613,7 +3613,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/network-controller": ^19.0.0 "@metamask/permission-controller": ^10.0.0 @@ -3640,7 +3640,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/approval-controller": ^7.0.0 "@metamask/keyring-controller": ^17.0.0 @@ -3813,7 +3813,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@babel/runtime": ^7.23.9 @@ -3850,7 +3850,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@metamask/approval-controller": ^7.0.0 @@ -12769,6 +12769,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:~5.0.4": + version: 5.0.4 + resolution: "typescript@npm:5.0.4" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 82b94da3f4604a8946da585f7d6c3025fff8410779e5bde2855ab130d05e4fd08938b9e593b6ebed165bda6ad9292b230984f10952cf82f0a0ca07bbeaa08172 + languageName: node + linkType: hard + "typescript@patch:typescript@~4.9.5#~builtin": version: 4.9.5 resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin::version=4.9.5&hash=d73830" @@ -12779,6 +12789,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@~5.0.4#~builtin": + version: 5.0.4 + resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=d73830" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 6a1fe9a77bb9c5176ead919cc4a1499ee63e46b4e05bf667079f11bf3a8f7887f135aa72460a4c3b016e6e6bb65a822cb8689a6d86cbfe92d22cc9f501f09213 + languageName: node + linkType: hard + "unbox-primitive@npm:^1.0.2": version: 1.0.2 resolution: "unbox-primitive@npm:1.0.2" From 5084b8f0792fa6449a5ed4ea33651138dcda7e4e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 9 May 2024 02:25:20 -0400 Subject: [PATCH 02/47] Set tsconfig `module`, `moduleResolution` options to `NodeNext` --- tsconfig.packages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.packages.json b/tsconfig.packages.json index c759b3d665..875bc0339d 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -3,8 +3,8 @@ "composite": true, "esModuleInterop": true, "lib": ["ES2020", "DOM"], - "module": "CommonJS", - "moduleResolution": "node", + "module": "NodeNext", + "moduleResolution": "NodeNext", /** * Here we ensure that TypeScript resolves `@metamask/*` imports to the * uncompiled source code for packages that live in this repo. From 1d77aa83f49bb2c72f24e34d5f9d629b81f710df Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Thu, 14 Mar 2024 16:55:23 -0600 Subject: [PATCH 03/47] 'yarn build:types' works --- .depcheckrc.yml | 2 + package.json | 1 + packages/assets-controllers/package.json | 3 +- packages/assets-controllers/src/assetsUtil.ts | 2 +- yarn.lock | 70 +++++++++++++++++-- 5 files changed, 70 insertions(+), 8 deletions(-) diff --git a/.depcheckrc.yml b/.depcheckrc.yml index 60c1aa5cd1..a7fae7d54b 100644 --- a/.depcheckrc.yml +++ b/.depcheckrc.yml @@ -12,9 +12,11 @@ ignores: - '@metamask/create-release-branch' - 'depcheck' - 'eslint-interactive' + - 'rimraf' - 'simple-git-hooks' - 'ts-node' - 'typedoc' + - 'which' # Ignore plugins implicitly imported by tools - 'jest-silent-reporter' - 'prettier-plugin-packagejson' diff --git a/package.json b/package.json index d942ea1f4b..5db3eb0709 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "nock": "^13.3.1", "prettier": "^2.7.1", "prettier-plugin-packagejson": "^2.4.5", + "rimraf": "^5.0.5", "simple-git-hooks": "^2.8.0", "ts-node": "^10.9.1", "tsup": "^8.0.2", diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index 38aac99c45..b64fbd586f 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -65,8 +65,9 @@ "async-mutex": "^0.5.0", "bn.js": "^5.2.1", "cockatiel": "^3.1.2", + "immer": "^9.0.6", "lodash": "^4.17.21", - "multiformats": "^9.5.2", + "multiformats": "^13.1.0", "single-call-balance-checker-abi": "^1.0.0", "uuid": "^8.3.2" }, diff --git a/packages/assets-controllers/src/assetsUtil.ts b/packages/assets-controllers/src/assetsUtil.ts index fde0247040..0f06f0ab53 100644 --- a/packages/assets-controllers/src/assetsUtil.ts +++ b/packages/assets-controllers/src/assetsUtil.ts @@ -6,7 +6,7 @@ import { import type { Hex } from '@metamask/utils'; import { remove0x } from '@metamask/utils'; import BN from 'bn.js'; -import { CID } from 'multiformats/cid'; +import { CID } from 'multiformats'; import type { Nft, NftMetadata } from './NftController'; import type { AbstractTokenPricesService } from './token-prices-service'; diff --git a/yarn.lock b/yarn.lock index 23966a337f..2088d5986e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2338,10 +2338,11 @@ __metadata: bn.js: ^5.2.1 cockatiel: ^3.1.2 deepmerge: ^4.2.2 + immer: ^9.0.6 jest: ^27.5.1 jest-environment-jsdom: ^27.5.1 lodash: ^4.17.21 - multiformats: ^9.5.2 + multiformats: ^13.1.0 nock: ^13.3.1 single-call-balance-checker-abi: ^1.0.0 sinon: ^9.2.4 @@ -2587,6 +2588,7 @@ __metadata: nock: ^13.3.1 prettier: ^2.7.1 prettier-plugin-packagejson: ^2.4.5 + rimraf: ^5.0.5 simple-git-hooks: ^2.8.0 ts-node: ^10.9.1 tsup: ^8.0.2 @@ -8025,6 +8027,21 @@ __metadata: languageName: node linkType: hard +"glob@npm:^10.3.7": + version: 10.4.1 + resolution: "glob@npm:10.4.1" + dependencies: + foreground-child: ^3.1.0 + jackspeak: ^3.1.2 + minimatch: ^9.0.4 + minipass: ^7.1.2 + path-scurry: ^1.11.1 + bin: + glob: dist/esm/bin.mjs + checksum: 5d33c686c80bf6877f4284adf99a8c3cbb2a6eccbc92342943fe5d4b42c01d78c1881f2223d950c92a938d0f857e12e37b86a8e5483ab2141822e053b67d0dde + languageName: node + linkType: hard + "glob@npm:^7.1.1, glob@npm:^7.1.2, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.7, glob@npm:^7.2.0": version: 7.2.3 resolution: "glob@npm:7.2.3" @@ -8930,6 +8947,19 @@ __metadata: languageName: node linkType: hard +"jackspeak@npm:^3.1.2": + version: 3.1.2 + resolution: "jackspeak@npm:3.1.2" + dependencies: + "@isaacs/cliui": ^8.0.2 + "@pkgjs/parseargs": ^0.11.0 + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 134276d5f785c518930701a0dcba1f3b0e9ce3e5b1c3e300898e2ae0bbd9b5195088b77252bf2110768de072c426e9e39f47e13912b0b002da4a3f4ff6e16eac + languageName: node + linkType: hard + "jest-changed-files@npm:^27.5.1": version: 27.5.1 resolution: "jest-changed-files@npm:27.5.1" @@ -10169,7 +10199,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.0, minimatch@npm:^9.0.1": +"minimatch@npm:^9.0.0, minimatch@npm:^9.0.1, minimatch@npm:^9.0.4": version: 9.0.4 resolution: "minimatch@npm:9.0.4" dependencies: @@ -10259,6 +10289,13 @@ __metadata: languageName: node linkType: hard +"minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: 2bfd325b95c555f2b4d2814d49325691c7bee937d753814861b0b49d5edcda55cbbf22b6b6a60bb91eddac8668771f03c5ff647dcd9d0f798e9548b9cdc46ee3 + languageName: node + linkType: hard + "minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": version: 2.1.2 resolution: "minizlib@npm:2.1.2" @@ -10299,10 +10336,10 @@ __metadata: languageName: node linkType: hard -"multiformats@npm:^9.5.2": - version: 9.9.0 - resolution: "multiformats@npm:9.9.0" - checksum: d3e8c1be400c09a014f557ea02251a2710dbc9fca5aa32cc702ff29f636c5471e17979f30bdcb0a9cbb556f162a8591dc2e1219c24fc21394a56115b820bb84e +"multiformats@npm:^13.1.0": + version: 13.1.0 + resolution: "multiformats@npm:13.1.0" + checksum: b970e3622a80192a4df8c23378c4854520df8b2d17db773ac8b77c19750019e1c9813cc05e12b0e3b0d03599ff5d073681e847d43b4b273efca5aabbb28eb0e0 languageName: node linkType: hard @@ -10847,6 +10884,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^1.11.1": + version: 1.11.1 + resolution: "path-scurry@npm:1.11.1" + dependencies: + lru-cache: ^10.2.0 + minipass: ^5.0.0 || ^6.0.2 || ^7.0.0 + checksum: 890d5abcd593a7912dcce7cf7c6bf7a0b5648e3dee6caf0712c126ca0a65c7f3d7b9d769072a4d1baf370f61ce493ab5b038d59988688e0c5f3f646ee3c69023 + languageName: node + linkType: hard + "path-to-regexp@npm:^1.7.0": version: 1.8.0 resolution: "path-to-regexp@npm:1.8.0" @@ -11406,6 +11453,17 @@ __metadata: languageName: node linkType: hard +"rimraf@npm:^5.0.5": + version: 5.0.7 + resolution: "rimraf@npm:5.0.7" + dependencies: + glob: ^10.3.7 + bin: + rimraf: dist/esm/bin.mjs + checksum: 884852abf8aefd4667448d87bdab04120a8641266c828cf382ac811713547eda18f81799d2146ffec3178f357d83d44ec01c10095949c82e23551660732bf14f + languageName: node + linkType: hard + "ripemd160@npm:^2.0.0, ripemd160@npm:^2.0.1, ripemd160@npm:^2.0.2": version: 2.0.2 resolution: "ripemd160@npm:2.0.2" From dd45b15542c09ccab612368cf92682909505d357 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:56:21 -0400 Subject: [PATCH 04/47] Apply yarn patches to replace superstruct imports with `@metamask/superstruct` in all core nested dependencies --- ...ask-keyring-api-npm-6.1.0-1b3da6f710.patch | 21 + ...amask-snaps-sdk-npm-4.2.0-68c745cc62.patch | 86 + ...ask-snaps-utils-npm-7.4.0-61301b942a.patch | 39 + jest.config.scripts.js | 2 +- package.json | 11 + .../src/NftController.test.ts | 14 +- .../assets-controllers/src/NftController.ts | 2 +- .../src/TokenDetectionController.test.ts | 3 +- packages/assets-controllers/src/assetsUtil.ts | 12 +- packages/network-controller/src/index.ts | 3 +- .../user-operation-controller/package.json | 2 +- .../src/utils/validation.ts | 8 +- yarn.lock | 1587 +++++++++-------- 13 files changed, 992 insertions(+), 798 deletions(-) create mode 100644 .yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch create mode 100644 .yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch create mode 100644 .yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch diff --git a/.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch b/.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch new file mode 100644 index 0000000000..a8b5e7fbe7 --- /dev/null +++ b/.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch @@ -0,0 +1,21 @@ +diff --git a/dist/superstruct.d.ts b/dist/superstruct.d.ts +index b81329da445b729dc26533adb51443f14e58e5dc..2857b6d3d4c9070d7c557bd15f7c1b9bc41c9951 100644 +--- a/dist/superstruct.d.ts ++++ b/dist/superstruct.d.ts +@@ -1,6 +1,6 @@ + import type { Infer } from 'superstruct'; + import { Struct } from 'superstruct'; +-import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct/dist/utils'; ++import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct'; + declare const ExactOptionalSymbol: unique symbol; + export declare type ExactOptionalTag = { + type: typeof ExactOptionalSymbol; +diff --git a/dist/superstruct.js.map b/dist/superstruct.js.map +index 746668d2b1959fedd9150a9faf35ea30e30b5a7a..aaf130b761f57ade6c49f009f1f5c825186e858a 100644 +--- a/dist/superstruct.js.map ++++ b/dist/superstruct.js.map +@@ -1 +1 @@ +-{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAiE;AAkDjE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAA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AAQ,KAAK,QAAQ,CAAC;AAC/D,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct/dist/utils';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define('Url', (value: unknown) => {\n let url;\n\n try {\n url = new URL(value as string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === 'http:' || url.protocol === 'https:';\n});\n"]} +\ No newline at end of file ++{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAiE;AAkDjE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAAM,QAAQ,GAAW,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAA4B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE1E,OAAO,QAAQ,IAAI,MAAM,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,MAA4B;IAE5B,OAAO,IAAI,oBAAM,CAAC;QAChB,GAAG,MAAM;QAET,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;QAEnD,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACtB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAa,EAAE,GAAG,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC;AAZD,sCAYC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,IAAY,EACZ,OAAe;IAEf,OAAO,IAAA,oBAAM,EACX,IAAI,EACJ,CAAC,KAAc,EAAW,EAAE,CAC1B,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CACnD,CAAC;AACJ,CAAC;AATD,sCASC;AAED;;;;;GAKG;AACU,QAAA,SAAS,GAAG,IAAA,oBAAM,EAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,GAAG,CAAC;IAER,IAAI;QACF,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;KAChC;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IAED,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAC/D,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define('Url', (value: unknown) => {\n let url;\n\n try {\n url = new URL(value as string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === 'http:' || url.protocol === 'https:';\n});\n"]} +\ No newline at end of file diff --git a/.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch b/.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch new file mode 100644 index 0000000000..8f50ba4d30 --- /dev/null +++ b/.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch @@ -0,0 +1,86 @@ +diff --git a/dist/index.js.map b/dist/index.js.map +index 6c595143a30baf9d8d11d37c9a9fd8e99c1d105a..96388eac12d945ff9171aa1e6b2524441f0ced5b 100644 +--- a/dist/index.js.map ++++ b/dist/index.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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AS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9DV;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AACF,CAAC;;;AD3QM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} +\ No newline at end of file ++{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;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S,UAAU,CAAC,sBAAkB,6BAAO,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAKM,IAAMC,cAAoC,QAAQ,QAAQ;AAAA,EAC/D,UAAU;AAAA,QACR,+BAAS,UAAU,KAAC,6BAAO,GAAG,YAAY,cAAc,UAAU,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAMC,aAAkC,QAAQ,OAAO;AAAA,EAC5D,WAAO,6BAAO;AAAA,EACd,UAAU,UAAU,CAACN,gBAAeI,cAAaC,WAAU,CAAC;AAAA,EAC5D,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9DV;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AACF,CAAC;;;AD3QM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} +\ No newline at end of file +diff --git a/dist/index.mjs.map b/dist/index.mjs.map +index 37e6e42d8b21d05b7c6f47cf0808f7f4649e6e28..ba18c8e411f62a240a246db387e73f5993119ba0 100644 +--- a/dist/index.mjs.map ++++ b/dist/index.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KA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Q,QAAQ;AAAA,EAC/D,MAAMA,SAAO;AAAA,EACb,UAAU,WAAWG,UAAS,UAAU,CAAC,kBAAkBH,SAAO,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAKM,IAAMiB,cAAoC,QAAQ,QAAQ;AAAA,EAC/D,UAAU;AAAA,IACRd,UAAS,UAAU,CAACH,SAAO,GAAG,YAAY,cAAc,UAAU,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAMkB,aAAkC,QAAQ,OAAO;AAAA,EAC5D,OAAOlB,SAAO;AAAA,EACd,UAAU,UAAU,CAACW,gBAAeK,cAAaC,WAAU,CAAC;AAAA,EAC5D,SAASX;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAMa,iBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9Dd;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AACF,CAAC;;;AD3QM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union"]} +\ No newline at end of file ++{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,g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F,CAAC;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union"]} +\ No newline at end of file +diff --git a/dist/jsx/index.js.map b/dist/jsx/index.js.map +index 58ffd5459c481a2dd61558c83f717dfe84d88f93..c4d6c196c62b13f4535ba684956d38d4a46e81a1 100644 +--- a/dist/jsx/index.js.map ++++ b/dist/jsx/index.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;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MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACrBxE,IAAMA,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACbtE,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AClBpE,IAAMC,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KAAI;;;ACfpE,IAAMC,QAAO;AAeN,IAAM,SAAS,oBAA8CA,KAAI;;;AC1BxE,IAAMC,QAAO;AAcN,IAAM,UAAU,oBAA+CA,KAAI;;;ACb1E,IAAMC,QAAO;AAaN,IAAM,MAAM,oBAA2CA,KAAI;;;ACXlE,IAAMC,QAAO;AAeN,IAAM,WAAW,oBAAgD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","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file +diff --git a/dist/jsx/index.mjs.map b/dist/jsx/index.mjs.map +index fab9aed63f9a17d965197d6e16426b13a3d94b98..8116fb46395f99f8a143015db1c8b4e0a610ddc0 100644 +--- a/dist/jsx/index.mjs.map ++++ b/dist/jsx/index.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AA4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C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,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AA4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACrBxE,IAAMA,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACbtE,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AClBpE,IAAMC,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KAAI;;;ACfpE,IAAMC,QAAO;AAeN,IAAM,SAAS,oBAA8CA,KAAI;;;AC1BxE,IAAMC,QAAO;AAcN,IAAM,UAAU,oBAA+CA,KAAI;;;ACb1E,IAAMC,QAAO;AAaN,IAAM,MAAM,oBAA2CA,KAAI;;;ACXlE,IAAMC,QAAO;AAeN,IAAM,WAAW,oBAAgDA,KAAI;;;AC5B5E,IAAMC,SAAO;AAYN,IAA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YPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} +\ No newline at end of file +diff --git a/dist/jsx/jsx-dev-runtime.js.map b/dist/jsx/jsx-dev-runtime.js.map +index f88a029455fa126ff7cb6ef9eea3d80f22282892..5dc414b70da44cd9e3393696aac15f7b9a923f64 100644 +--- a/dist/jsx/jsx-dev-runtime.js.map ++++ b/dist/jsx/jsx-dev-runtime.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mB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,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAWO;;;ACjBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AA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AA,IACH;AAAA,EACF;AACF;;;AFvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file +diff --git a/dist/jsx/jsx-dev-runtime.mjs.map b/dist/jsx/jsx-dev-runtime.mjs.map +index 9b27b0cd4eedb8b629fa276f80bf742abda5f2f9..7b16cd30c9cfbd91cc9647f38471dffde4ff44b5 100644 +--- a/dist/jsx/jsx-dev-runtime.mjs.map ++++ b/dist/jsx/jsx-dev-runtime.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,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A;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMA,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAA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AA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMA,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["element"]} +\ No newline at end of file +diff --git a/dist/tsconfig.build.tsbuildinfo b/dist/tsconfig.build.tsbuildinfo +index e5734d76312a2f97c8c6e66729166cbf03405d9b..2f08eea89654d55e90ab540b52e9962a13fa583b 100644 +--- a/dist/tsconfig.build.tsbuildinfo ++++ b/dist/tsconfig.build.tsbuildinfo +@@ -1 +1 @@ +-{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"00b35725eb9cfb53b568275121003ded0451b325c4cdf8e621c3da0200a7de8a","signature":"44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"bced4502948086d1afc2e3931fa95e125135aec142ae932defd777531044538a","signature":"16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"eb81f1227111d1a4af7080772f41d9766f2317aa8a62ba8f354177ef4ee40e8a","signature":"87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"5eb900501cd7790ef0a0ba0efb190b3c716e7512cd0b2b06ab9897f05f800a80","signature":"8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"04509460deee68bc7741c1b6a45891bafcbeabf665fcb73d7bbb56a757850519","signature":"77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"24145523e59b466efe57f26bf973308cab6c859cf885be0c02161e269dbf0833","signature":"ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"de358de61e5a1484b206d25041c62e946f0ac779b7a98ef60608ecd39bb09f35","signature":"6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"1b20522a1a169d9a7480e79a463d65011f67f65ddbae3a9a86baa75629f6810f","signature":"cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"4b35ad670bc9613bc53b5a9b3f29505cf185b1d403eb44e938041ad1d73b3300","signature":"03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"6b87577f1a3f1847652e14db5381e239038f35863699216747e477699aa735f3","signature":"1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"73c82247029576946f99cca02ebcfb1c2016e77bc94cb3c5df911e8e156ceaf0","signature":"58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3"},{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,291],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,186],[108,154,187],[108,187,188,189,190,191,192],[108,207,216,217,220],[108,207,216,219],[108,207,216,218,220],[108,208,211,212,214],[108,208,209,210],[108,211,212,214,215],[108,208,209,213],[108,219,225],[108,207,216,219,225],[108,216,219,225],[108,216,219,221,222,223,224],[108,207,216,217,218,219,220,225],[108,207,216],[108,154,186,193,194],[108,195],[108,115,154,195,198,199],[108,115,154,186,193,195,198],[108,199],[108,194,195,196,199,200,201,202,203],[108,115,196,198,201],[108,194,201],[108,154,193],[108,154,176],[108,176,177],[108,176,177,178,179],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,208],[108,291,292,293,294,295],[108,291,293],[81,108,115,298],[72,108,115],[108,115,301],[108,303],[108,304,305,307],[96,108,115],[107,108,115,314],[81,108,115],[108,144],[108,320,321],[108,318,319,320],[78,81,108,115,311,312,313],[108,299,313,314,325],[108,306],[78,108,115,329],[79,108,115],[108,333],[108,339],[78,81,83,86,96,107,108,115],[108,344],[108,344,346],[108,345],[108,352,357],[108,350,353],[108,350,353,354,355],[108,352],[108,349,356],[108,351],[78,108,110,115,371,372,374],[108,373],[108,388],[108,376,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,379,380,381,382,383,384,385,386,387,388],[108,377,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,378,380,381,382,383,384,385,386,387,388],[108,376,377,378,379,381,382,383,384,385,386,387,388],[108,376,377,378,379,380,382,383,384,385,386,387,388],[108,376,377,378,379,380,381,383,384,385,386,387,388],[108,376,377,378,379,380,381,382,384,385,386,387,388],[108,376,377,378,379,380,381,382,383,385,386,387,388],[108,376,377,378,379,380,381,382,383,384,386,387,388],[108,376,377,378,379,380,381,382,383,384,385,387,388],[108,376,377,378,379,380,381,382,383,384,385,386,388],[108,376,377,378,379,380,381,382,383,384,385,386,387],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,339,398],[108,398,399,400,401,402],[108,335,336,337,338],[108,115,197],[79,108,115,330],[108,408,447],[108,408,432,447],[108,447],[108,408],[108,408,433,447],[108,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446],[108,433,447],[79,96,108,115,310],[79,81,108,115],[79,108,326],[81,108,115,324],[108,324],[108,323],[108,115,459,460,461,462,463,464,465,466,467,468,469],[108,458,459,468],[108,459,468],[108,451,458,459,468],[108,459],[71,108,458,468],[108,458,459,460,461,462,463,464,465,466,467,469],[78,81,83,96,104,107,108,113,115],[108,473],[78,96,108,115],[108,329],[108,327,328],[108,360],[108,359,360],[108,359],[108,359,360,361,363,364,367,368,369,370],[108,360,364],[108,359,360,361,363,364,365,366],[108,359,364],[108,364,368],[108,360,361,362],[108,361],[108,359,360,364],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,180,283,286],[108,154,283,286],[108,154,251,286],[108,154,181,251,279,283,286,287,288],[108,154,180,181,286],[108,154,286],[108,182,183,184,185,280,282,286],[44,50,108,185,279,286],[44,50,108,184,286],[108,154,281,286],[108,155,286],[108,155,169,286],[108,155,156,166,171,286],[108,155,165,169,286],[108,155,161,286],[108,155,160,162,286],[108,160,161,162,163,286],[108,155,166,286],[108,167,168,286],[108,156,157,158,159,164,165,166,169,170,171,172,173,286],[108,155,174,175,284,285,286],[108,155,175,284,286],[44,50,108,154,155,174,279,283,286],[108,286],[108,266,286],[108,279,286],[108,269,270,271,272,273,274,275,276,277,286],[108,154,227,286],[108,251,275,283,286],[108,227,279,283,286],[50,108,286],[108,227,228,252,255,265,266,267,278,286],[50,108,251,286],[108,279,283,286],[108,226,228,286],[108,228,286],[108,283,286],[108,252,286],[108,154,255,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,264,286],[108,154,257,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283,286],[108,154,226,227,286],[108,204,265,286],[108,154,228,286],[50,108,154,235,249,286],[50,108,154,249,286],[50,108,154,235,236,286],[50,108,235,236,283,286],[50,108,235,236,286],[50,108,235,236,242,243,286],[108,237,238,239,240,241,242,243,244,245,246,247,248,286],[50,108,235,236,237,238,239,240,241,242,243,244,245,246,247,286],[50,108,235,236,237,241,245,283,286],[108,235,249,250,286],[154,181],[154,283],[251],[154,181,251,279,283,287,288],[154,180,181],[154],[44,50,279],[44,50,184],[155],[155,169],[155,156,166,171],[155,165,169],[155,161],[155,160,162],[160,161,162,163],[167,168],[156,157,158,159,164,165,166,169,170,171,172,173],[155,174,175,284,285],[155,174,283],[266],[279],[154,227],[251,275,283],[227,279,283],[50],[227,228,252,255,265,266,267,278],[50,251,286],[279,283],[226,228],[228],[283],[252],[154,255],[154,257],[205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283],[154,226,227],[204,265],[154,228],[50,235,249],[249],[50,235]],"referencedMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,197],[181,198],[288,199],[289,200],[182,201],[183,202],[184,202],[283,203],[280,204],[185,205],[282,206],[155,202],[156,207],[157,207],[158,207],[159,207],[170,207],[171,207],[165,208],[172,209],[173,207],[166,210],[160,207],[162,211],[163,212],[161,207],[164,213],[167,214],[168,207],[169,215],[174,216],[286,217],[285,218],[175,207],[284,219],[227,220],[267,221],[269,202],[270,222],[278,223],[271,202],[272,202],[273,224],[274,202],[276,225],[275,226],[277,227],[268,2],[279,228],[252,229],[205,222],[206,230],[229,231],[230,232],[231,231],[232,220],[233,202],[234,233],[253,234],[254,220],[256,235],[265,236],[258,237],[257,202],[259,202],[260,198],[264,238],[261,233],[262,235],[263,222],[228,239],[266,240],[255,241],[236,242],[250,243],[237,244],[242,245],[238,246],[239,246],[244,247],[240,246],[241,245],[249,248],[243,245],[248,249],[246,250],[247,246],[245,246],[251,251],[235,227]],"exportedModulesMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,252],[181,253],[288,254],[289,255],[182,256],[183,257],[184,257],[283,203],[280,258],[185,259],[155,257],[156,260],[157,260],[158,260],[159,260],[170,260],[171,260],[165,261],[172,262],[173,260],[166,263],[160,260],[162,264],[163,265],[161,260],[164,266],[167,260],[168,260],[169,267],[174,268],[286,269],[285,260],[175,260],[284,270],[267,271],[269,257],[270,272],[278,223],[271,257],[272,257],[273,273],[274,257],[276,274],[275,275],[277,276],[279,277],[252,278],[205,272],[206,279],[229,280],[230,281],[231,280],[233,257],[234,282],[253,283],[256,284],[265,236],[258,285],[257,257],[259,257],[260,253],[264,286],[261,282],[262,284],[263,272],[228,287],[266,288],[255,289],[236,290],[250,291],[237,292],[242,292],[238,292],[239,292],[244,292],[240,292],[241,292],[249,248],[243,292],[248,292],[246,292],[247,292],[245,292],[251,251],[235,276]],"semanticDiagnosticsPerFile":[293,291,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,187,188,189,190,191,193,192,218,220,219,207,215,211,212,216,214,221,222,223,225,224,226,217,195,196,201,199,200,204,202,203,194,177,179,178,180,176,186,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,210,208,209,213,290,296,292,294,295,297,299,300,302,305,304,308,309,315,298,316,145,317,322,318,321,320,314,326,307,306,330,331,332,303,334,340,341,342,343,301,344,345,347,348,358,350,354,356,355,353,357,352,351,373,374,319,375,389,377,378,376,379,380,381,382,383,384,385,386,387,388,390,310,391,392,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,393,394,395,337,396,313,312,397,399,401,398,400,402,403,335,339,198,197,404,405,406,407,338,432,433,408,411,430,431,421,420,418,413,426,424,428,412,425,429,414,415,427,409,416,417,419,423,434,422,410,447,446,441,443,442,435,436,438,440,444,445,437,439,311,448,449,325,323,324,450,451,452,453,372,333,454,455,456,457,470,469,460,461,462,463,464,465,466,459,467,468,458,471,472,473,474,475,118,349,336,281,327,329,328,361,370,359,360,371,366,367,365,369,363,362,368,364,346,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,287,181,288,289,182,183,184,283,280,185,282,155,156,157,158,159,170,171,165,172,173,166,160,162,163,161,164,167,168,169,174,286,285,175,284,227,267,269,270,278,271,272,273,274,276,275,277,268,279,252,205,206,229,230,231,232,233,234,253,254,256,265,258,257,259,260,264,261,262,263,228,266,255,236,250,237,242,238,239,244,240,241,249,243,248,246,247,245,251,235],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} +\ No newline at end of file ++{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"00b35725eb9cfb53b568275121003ded0451b325c4cdf8e621c3da0200a7de8a","signature":"44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"bced4502948086d1afc2e3931fa95e125135aec142ae932defd777531044538a","signature":"16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"eb81f1227111d1a4af7080772f41d9766f2317aa8a62ba8f354177ef4ee40e8a","signature":"87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"5eb900501cd7790ef0a0ba0efb190b3c716e7512cd0b2b06ab9897f05f800a80","signature":"8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"04509460deee68bc7741c1b6a45891bafcbeabf665fcb73d7bbb56a757850519","signature":"77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"24145523e59b466efe57f26bf973308cab6c859cf885be0c02161e269dbf0833","signature":"ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"de358de61e5a1484b206d25041c62e946f0ac779b7a98ef60608ecd39bb09f35","signature":"6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"1b20522a1a169d9a7480e79a463d65011f67f65ddbae3a9a86baa75629f6810f","signature":"cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"4b35ad670bc9613bc53b5a9b3f29505cf185b1d403eb44e938041ad1d73b3300","signature":"03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"6b87577f1a3f1847652e14db5381e239038f35863699216747e477699aa735f3","signature":"1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"73c82247029576946f99cca02ebcfb1c2016e77bc94cb3c5df911e8e156ceaf0","signature":"58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3"},{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,291],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,186],[108,154,187],[108,187,188,189,190,191,192],[108,207,216,217,220],[108,207,216,219],[108,207,216,218,220],[108,208,211,212,214],[108,208,209,210],[108,211,212,214,215],[108,208,209,213],[108,219,225],[108,207,216,219,225],[108,216,219,225],[108,216,219,221,222,223,224],[108,207,216,217,218,219,220,225],[108,207,216],[108,154,186,193,194],[108,195],[108,115,154,195,198,199],[108,115,154,186,193,195,198],[108,199],[108,194,195,196,199,200,201,202,203],[108,115,196,198,201],[108,194,201],[108,154,193],[108,154,176],[108,176,177],[108,176,177,178,179],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,208],[108,291,292,293,294,295],[108,291,293],[81,108,115,298],[72,108,115],[108,115,301],[108,303],[108,304,305,307],[96,108,115],[107,108,115,314],[81,108,115],[108,144],[108,320,321],[108,318,319,320],[78,81,108,115,311,312,313],[108,299,313,314,325],[108,306],[78,108,115,329],[79,108,115],[108,333],[108,339],[78,81,83,86,96,107,108,115],[108,344],[108,344,346],[108,345],[108,352,357],[108,350,353],[108,350,353,354,355],[108,352],[108,349,356],[108,351],[78,108,110,115,371,372,374],[108,373],[108,388],[108,376,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,379,380,381,382,383,384,385,386,387,388],[108,377,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,378,380,381,382,383,384,385,386,387,388],[108,376,377,378,379,381,382,383,384,385,386,387,388],[108,376,377,378,379,380,382,383,384,385,386,387,388],[108,376,377,378,379,380,381,383,384,385,386,387,388],[108,376,377,378,379,380,381,382,384,385,386,387,388],[108,376,377,378,379,380,381,382,383,385,386,387,388],[108,376,377,378,379,380,381,382,383,384,386,387,388],[108,376,377,378,379,380,381,382,383,384,385,387,388],[108,376,377,378,379,380,381,382,383,384,385,386,388],[108,376,377,378,379,380,381,382,383,384,385,386,387],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,339,398],[108,398,399,400,401,402],[108,335,336,337,338],[108,115,197],[79,108,115,330],[108,408,447],[108,408,432,447],[108,447],[108,408],[108,408,433,447],[108,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446],[108,433,447],[79,96,108,115,310],[79,81,108,115],[79,108,326],[81,108,115,324],[108,324],[108,323],[108,115,459,460,461,462,463,464,465,466,467,468,469],[108,458,459,468],[108,459,468],[108,451,458,459,468],[108,459],[71,108,458,468],[108,458,459,460,461,462,463,464,465,466,467,469],[78,81,83,96,104,107,108,113,115],[108,473],[78,96,108,115],[108,329],[108,327,328],[108,360],[108,359,360],[108,359],[108,359,360,361,363,364,367,368,369,370],[108,360,364],[108,359,360,361,363,364,365,366],[108,359,364],[108,364,368],[108,360,361,362],[108,361],[108,359,360,364],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,180,283,286],[108,154,283,286],[108,154,251,286],[108,154,181,251,279,283,286,287,288],[108,154,180,181,286],[108,154,286],[108,182,183,184,185,280,282,286],[44,50,108,185,279,286],[44,50,108,184,286],[108,154,281,286],[108,155,286],[108,155,169,286],[108,155,156,166,171,286],[108,155,165,169,286],[108,155,161,286],[108,155,160,162,286],[108,160,161,162,163,286],[108,155,166,286],[108,167,168,286],[108,156,157,158,159,164,165,166,169,170,171,172,173,286],[108,155,174,175,284,285,286],[108,155,175,284,286],[44,50,108,154,155,174,279,283,286],[108,286],[108,266,286],[108,279,286],[108,269,270,271,272,273,274,275,276,277,286],[108,154,227,286],[108,251,275,283,286],[108,227,279,283,286],[50,108,286],[108,227,228,252,255,265,266,267,278,286],[50,108,251,286],[108,279,283,286],[108,226,228,286],[108,228,286],[108,283,286],[108,252,286],[108,154,255,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,264,286],[108,154,257,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283,286],[108,154,226,227,286],[108,204,265,286],[108,154,228,286],[50,108,154,235,249,286],[50,108,154,249,286],[50,108,154,235,236,286],[50,108,235,236,283,286],[50,108,235,236,286],[50,108,235,236,242,243,286],[108,237,238,239,240,241,242,243,244,245,246,247,248,286],[50,108,235,236,237,238,239,240,241,242,243,244,245,246,247,286],[50,108,235,236,237,241,245,283,286],[108,235,249,250,286],[154,181],[154,283],[251],[154,181,251,279,283,287,288],[154,180,181],[154],[44,50,279],[44,50,184],[155],[155,169],[155,156,166,171],[155,165,169],[155,161],[155,160,162],[160,161,162,163],[167,168],[156,157,158,159,164,165,166,169,170,171,172,173],[155,174,175,284,285],[155,174,283],[266],[279],[154,227],[251,275,283],[227,279,283],[50],[227,228,252,255,265,266,267,278],[50,251,286],[279,283],[226,228],[228],[283],[252],[154,255],[154,257],[205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283],[154,226,227],[204,265],[154,228],[50,235,249],[249],[50,235]],"referencedMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,197],[181,198],[288,199],[289,200],[182,201],[183,202],[184,202],[283,203],[280,204],[185,205],[282,206],[155,202],[156,207],[157,207],[158,207],[159,207],[170,207],[171,207],[165,208],[172,209],[173,207],[166,210],[160,207],[162,211],[163,212],[161,207],[164,213],[167,214],[168,207],[169,215],[174,216],[286,217],[285,218],[175,207],[284,219],[227,220],[267,221],[269,202],[270,222],[278,223],[271,202],[272,202],[273,224],[274,202],[276,225],[275,226],[277,227],[268,2],[279,228],[252,229],[205,222],[206,230],[229,231],[230,232],[231,231],[232,220],[233,202],[234,233],[253,234],[254,220],[256,235],[265,236],[258,237],[257,202],[259,202],[260,198],[264,238],[261,233],[262,235],[263,222],[228,239],[266,240],[255,241],[236,242],[250,243],[237,244],[242,245],[238,246],[239,246],[244,247],[240,246],[241,245],[249,248],[243,245],[248,249],[246,250],[247,246],[245,246],[251,251],[235,227]],"exportedModulesMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,252],[181,253],[288,254],[289,255],[182,256],[183,257],[184,257],[283,203],[280,258],[185,259],[155,257],[156,260],[157,260],[158,260],[159,260],[170,260],[171,260],[165,261],[172,262],[173,260],[166,263],[160,260],[162,264],[163,265],[161,260],[164,266],[167,260],[168,260],[169,267],[174,268],[286,269],[285,260],[175,260],[284,270],[267,271],[269,257],[270,272],[278,223],[271,257],[272,257],[273,273],[274,257],[276,274],[275,275],[277,276],[279,277],[252,278],[205,272],[206,279],[229,280],[230,281],[231,280],[233,257],[234,282],[253,283],[256,284],[265,236],[258,285],[257,257],[259,257],[260,253],[264,286],[261,282],[262,284],[263,272],[228,287],[266,288],[255,289],[236,290],[250,291],[237,292],[242,292],[238,292],[239,292],[244,292],[240,292],[241,292],[249,248],[243,292],[248,292],[246,292],[247,292],[245,292],[251,251],[235,276]],"semanticDiagnosticsPerFile":[293,291,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,187,188,189,190,191,193,192,218,220,219,207,215,211,212,216,214,221,222,223,225,224,226,217,195,196,201,199,200,204,202,203,194,177,179,178,180,176,186,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,210,208,209,213,290,296,292,294,295,297,299,300,302,305,304,308,309,315,298,316,145,317,322,318,321,320,314,326,307,306,330,331,332,303,334,340,341,342,343,301,344,345,347,348,358,350,354,356,355,353,357,352,351,373,374,319,375,389,377,378,376,379,380,381,382,383,384,385,386,387,388,390,310,391,392,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,393,394,395,337,396,313,312,397,399,401,398,400,402,403,335,339,198,197,404,405,406,407,338,432,433,408,411,430,431,421,420,418,413,426,424,428,412,425,429,414,415,427,409,416,417,419,423,434,422,410,447,446,441,443,442,435,436,438,440,444,445,437,439,311,448,449,325,323,324,450,451,452,453,372,333,454,455,456,457,470,469,460,461,462,463,464,465,466,459,467,468,458,471,472,473,474,475,118,349,336,281,327,329,328,361,370,359,360,371,366,367,365,369,363,362,368,364,346,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,287,181,288,289,182,183,184,283,280,185,282,155,156,157,158,159,170,171,165,172,173,166,160,162,163,161,164,167,168,169,174,286,285,175,284,227,267,269,270,278,271,272,273,274,276,275,277,268,279,252,205,206,229,230,231,232,233,234,253,254,256,265,258,257,259,260,264,261,262,263,228,266,255,236,250,237,242,238,239,244,240,241,249,243,248,246,247,245,251,235],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} +\ No newline at end of file +diff --git a/dist/types/internals/jsx.d.ts b/dist/types/internals/jsx.d.ts +index 95a075622f84c1a90d0156f4c4fe30e3b3274aed..843448bcb514a3054c393683524e5eaec8b2cff0 100644 +--- a/dist/types/internals/jsx.d.ts ++++ b/dist/types/internals/jsx.d.ts +@@ -1,5 +1,5 @@ + import type { Infer, Struct } from 'superstruct'; +-import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct/dist/utils'; ++import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct'; + import type { EmptyObject } from '../types'; + /** + * Check if a type is a union. Infers `true` if it is a union, otherwise +diff --git a/dist/types/internals/structs.d.ts b/dist/types/internals/structs.d.ts +index bbfc1289001614aa48dca8aef392f619be8281bb..a79728b0db71449e5fd96f668810856b5b8d54a4 100644 +--- a/dist/types/internals/structs.d.ts ++++ b/dist/types/internals/structs.d.ts +@@ -1,6 +1,6 @@ + import type { Infer } from 'superstruct'; + import { Struct } from 'superstruct'; +-import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; ++import type { AnyStruct, InferStructTuple } from 'superstruct'; + import type { EnumToUnion } from './helpers'; + /** + * A wrapper of `superstruct`'s `literal` struct that also defines the name of diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch new file mode 100644 index 0000000000..d9e2db8379 --- /dev/null +++ b/.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch @@ -0,0 +1,39 @@ +diff --git a/dist/chunk-A6E325SZ.js.map b/dist/chunk-A6E325SZ.js.map +index 9395ea8f11127b1883cf0b26f7049254cb1bf6ac..2bab6aca282a11ec815b3a02863423af8260fb85 100644 +--- a/dist/chunk-A6E325SZ.js.map ++++ b/dist/chunk-A6E325SZ.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,W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AC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,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OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-GTAYOKI4.mjs.map b/dist/chunk-GTAYOKI4.mjs.map +index 87b357f90e691edb205eba4b1d5991f705dc61fb..15cec06a31a88f47929cc8a9b7cecaef5daa8372 100644 +--- a/dist/chunk-GTAYOKI4.mjs.map ++++ b/dist/chunk-GTAYOKI4.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"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AAI,SAAS,OAAO,KAAK,EAAE,OAAO,CAAC;AAClD,MAAI,UAAU;AACZ,UAAM,IAAI;AAAA,MACR,wBAAwB,KAAK,SAAS,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,IAC5D;AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,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AClD,MAAI,UAAU;AACZ,UAAM,IAAI;AAAA,MACR,wBAAwB,KAAK,SAAS,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,IAC5D;AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} +\ No newline at end of file +diff --git a/dist/tsconfig.build.tsbuildinfo b/dist/tsconfig.build.tsbuildinfo +index 2f6c63b450f39745751adbf73598c1756650078e..7f0bf13393f108d3e1df381a86e67556d4749a3d 100644 +--- a/dist/tsconfig.build.tsbuildinfo ++++ b/dist/tsconfig.build.tsbuildinfo +@@ -1 +1 @@ +-{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../../snaps-sdk/dist/types/jsx/component.d.ts","../../snaps-sdk/dist/types/jsx/components/Address.d.ts","../../snaps-sdk/dist/types/jsx/components/Box.d.ts","../../snaps-sdk/dist/types/jsx/components/Copyable.d.ts","../../snaps-sdk/dist/types/jsx/components/Divider.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Button.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Input.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Field.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Form.d.ts","../../snaps-sdk/dist/types/jsx/components/form/index.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Bold.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Italic.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/index.d.ts","../../snaps-sdk/dist/types/jsx/components/Heading.d.ts","../../snaps-sdk/dist/types/jsx/components/Image.d.ts","../../snaps-sdk/dist/types/jsx/components/Link.d.ts","../../snaps-sdk/dist/types/jsx/components/Text.d.ts","../../snaps-sdk/dist/types/jsx/components/Row.d.ts","../../snaps-sdk/dist/types/jsx/components/Spinner.d.ts","../../snaps-sdk/dist/types/jsx/components/index.d.ts","../../snaps-sdk/dist/types/jsx/jsx-runtime.d.ts","../../snaps-sdk/dist/types/jsx/jsx-dev-runtime.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../../snaps-sdk/dist/types/errors.d.ts","../../snaps-sdk/dist/types/internals/error-wrappers.d.ts","../../snaps-sdk/dist/types/internals/errors.d.ts","../../snaps-sdk/dist/types/internals/helpers.d.ts","../../snaps-sdk/dist/types/internals/structs.d.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../../snaps-sdk/dist/types/types/methods/create-interface.d.ts","../../snaps-sdk/dist/types/types/methods/dialog.d.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../../snaps-sdk/dist/types/types/caip.d.ts","../../snaps-sdk/dist/types/types/permissions.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-public-key.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip44-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-client-status.d.ts","../../snaps-sdk/dist/types/types/methods/get-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-file.d.ts","../../snaps-sdk/dist/types/ui/nodes.d.ts","../../snaps-sdk/dist/types/ui/components/address.d.ts","../../snaps-sdk/dist/types/ui/components/copyable.d.ts","../../snaps-sdk/dist/types/ui/components/divider.d.ts","../../snaps-sdk/dist/types/ui/components/heading.d.ts","../../snaps-sdk/dist/types/ui/components/image.d.ts","../../snaps-sdk/dist/types/ui/components/panel.d.ts","../../snaps-sdk/dist/types/ui/components/spinner.d.ts","../../snaps-sdk/dist/types/ui/components/text.d.ts","../../snaps-sdk/dist/types/ui/components/row.d.ts","../../snaps-sdk/dist/types/ui/components/button.d.ts","../../snaps-sdk/dist/types/ui/components/input.d.ts","../../snaps-sdk/dist/types/ui/components/form.d.ts","../../snaps-sdk/dist/types/ui/components/index.d.ts","../../snaps-sdk/dist/types/ui/component.d.ts","../../snaps-sdk/dist/types/ui/index.d.ts","../../snaps-sdk/dist/types/types/interface.d.ts","../../snaps-sdk/dist/types/types/methods/get-interface-state.d.ts","../../snaps-sdk/dist/types/types/methods/get-locale.d.ts","../../snaps-sdk/dist/types/types/snap.d.ts","../../snaps-sdk/dist/types/types/methods/get-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-snap.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-keyring.d.ts","../../snaps-sdk/dist/types/types/methods/manage-accounts.d.ts","../../snaps-sdk/dist/types/types/methods/manage-state.d.ts","../../snaps-sdk/dist/types/types/methods/notify.d.ts","../../snaps-sdk/dist/types/types/methods/request-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/update-interface.d.ts","../../snaps-sdk/dist/types/types/methods/methods.d.ts","../../snaps-sdk/dist/types/types/methods/index.d.ts","../../snaps-sdk/dist/types/types/provider.d.ts","../../snaps-sdk/dist/types/types/global.d.ts","../../snaps-sdk/dist/types/types/images.d.ts","../../snaps-sdk/dist/types/types/handlers/cronjob.d.ts","../../snaps-sdk/dist/types/types/handlers/home-page.d.ts","../../snaps-sdk/dist/types/types/handlers/keyring.d.ts","../../snaps-sdk/dist/types/types/handlers/lifecycle.d.ts","../../snaps-sdk/dist/types/types/handlers/name-lookup.d.ts","../../snaps-sdk/dist/types/types/handlers/rpc-request.d.ts","../../snaps-sdk/dist/types/types/handlers/transaction.d.ts","../../snaps-sdk/dist/types/types/handlers/signature.d.ts","../../snaps-sdk/dist/types/types/handlers/user-input.d.ts","../../snaps-sdk/dist/types/types/handlers/index.d.ts","../../snaps-sdk/dist/types/types/index.d.ts","../../snaps-sdk/dist/types/internals/jsx.d.ts","../../snaps-sdk/dist/types/internals/svg.d.ts","../../snaps-sdk/dist/types/internals/index.d.ts","../../snaps-sdk/dist/types/jsx/validation.d.ts","../../snaps-sdk/dist/types/jsx/index.d.ts","../src/array.ts","../../snaps-sdk/dist/types/error-wrappers.d.ts","../../snaps-sdk/dist/types/images.d.ts","../../snaps-sdk/dist/types/index.d.ts","../../../node_modules/@scure/base/lib/index.d.ts","../../../node_modules/rfdc/index.d.ts","../src/deep-clone.ts","../src/virtual-file/VirtualFile.ts","../src/bytes.ts","../src/virtual-file/index.ts","../src/base64.ts","../src/auxiliary-files.ts","../src/caveats.ts","../../../node_modules/@noble/hashes/utils.d.ts","../../../node_modules/@noble/hashes/_md.d.ts","../../../node_modules/@noble/hashes/sha256.d.ts","../src/checksum.ts","../../../node_modules/cron-parser/types/common.d.ts","../../../node_modules/cron-parser/types/index.d.ts","../../../node_modules/cron-parser/index.d.ts","../src/cronjob.ts","../src/default-endowments.ts","../../../node_modules/@metamask/slip44/slip44.json","../src/derivation-paths.ts","../src/entropy.ts","../src/errors.ts","../src/handler-types.ts","../src/mock.ts","../src/eval-worker.ts","../src/json.ts","../src/virtual-file/toVirtualFile.ts","../src/virtual-file/node.ts","../src/fs.ts","../src/eval.ts","../src/handlers.ts","../src/icon.ts","../src/iframe.ts","../src/iframe.test.browser.ts","../src/logging.ts","../../../node_modules/chalk/index.d.ts","../src/strings.ts","../src/structs.ts","../src/namespace.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV1.d.ts","../../../node_modules/immer/dist/utils/env.d.ts","../../../node_modules/immer/dist/utils/errors.d.ts","../../../node_modules/immer/dist/types/types-external.d.ts","../../../node_modules/immer/dist/types/types-internal.d.ts","../../../node_modules/immer/dist/utils/common.d.ts","../../../node_modules/immer/dist/utils/plugins.d.ts","../../../node_modules/immer/dist/core/scope.d.ts","../../../node_modules/immer/dist/core/finalize.d.ts","../../../node_modules/immer/dist/core/proxy.d.ts","../../../node_modules/immer/dist/core/immerClass.d.ts","../../../node_modules/immer/dist/core/current.d.ts","../../../node_modules/immer/dist/internal.d.ts","../../../node_modules/immer/dist/plugins/es5.d.ts","../../../node_modules/immer/dist/plugins/patches.d.ts","../../../node_modules/immer/dist/plugins/mapset.d.ts","../../../node_modules/immer/dist/plugins/all.d.ts","../../../node_modules/immer/dist/immer.d.ts","../../../node_modules/@metamask/base-controller/dist/types/RestrictedControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/ControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV2.d.ts","../../../node_modules/@metamask/base-controller/dist/types/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/types.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/constants.d.ts","../../../node_modules/@metamask/eth-query/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/util.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/abnf.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/utils.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/parsers.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/siwe.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/index.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/ApprovalController.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/permission-middleware.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/SubjectMetadataController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/PermissionController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Permission.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Caveat.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/utils.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/getPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/requestPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/revokePermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/index.d.ts","../src/json-rpc.ts","../../../node_modules/@metamask/snaps-registry/dist/verify.d.ts","../../../node_modules/@metamask/snaps-registry/dist/index.d.ts","../../../node_modules/fast-json-stable-stringify/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../src/snaps.ts","../src/manifest/validation.ts","../src/manifest/index.ts","../src/localization.ts","../src/types.ts","../src/index.executionenv.ts","../src/path.ts","../../../node_modules/marked/lib/marked.d.ts","../src/ui.tsx","../src/validation.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../src/versions.ts","../src/index.ts","../../../node_modules/fast-deep-equal/index.d.ts","../src/npm.ts","../src/manifest/manifest.ts","../src/manifest/node.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../src/post-process.ts","../src/node.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f","c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b","9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff","44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e","043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3","e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3","5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d","cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef","16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3","f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d","87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060","c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add","efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac","3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe","bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58","b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3","5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51","8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21","8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60","b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1","77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a","31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba","d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41","9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d","6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4","cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff","9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c","a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0","0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34","fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2","ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269","3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284","5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2","6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8","0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554","5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609","80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a","2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643","cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3","9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94","122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45","f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08","0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36","e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8","5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335","92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590","3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd","20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870","078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51","68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d","56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7","2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed","620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f","6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0","080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d","874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c","6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749","6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96","d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a","747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2","b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c","e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71","b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c","15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1","4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183","73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3","3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941","3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1","50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e","3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c","72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb","f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf",{"version":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e","9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c","aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1","150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2","cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20","47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a","6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47","afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228","df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494","03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88","11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0","cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc","959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383","6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0","2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232","1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563","58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3",{"version":"2f700dfc0b29df3605475fcd717c0fc759c95e42067c389cbb503ba3bde9b155","signature":"00abf32ca3af92f8be9ecbc9b63090b4909a756317d791927a83cffd24e9c8ac"},"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10","6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3","abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6","27e882f5d19aee4c49dbdebedbfa79c3233b874adcdcac46295232c4c1bcd13b","1ce746559c2b493ba53418bb35dcfb13b8581bed88c0ac484d92b004077c4b4e",{"version":"27d30b08ab92c978b5f2bbda4a242ea927f908287edce0c2ed11ddcf52c80e01","signature":"900daf04dc607dc3858c0f976d6f9e17b829a07de58d62dc6f730eaf06986075"},{"version":"26351dd9044d932d46fc6472737c5335df5b4a9ad5f1ee1c157d328beb6744f4","signature":"8b2100d3ba68063b7baf5038f26eefe46543dcebf1e7dbaf46277f24307cefcb"},{"version":"5a55c1d9a73f1a1867915a6f043c5d05a439291aec5482b918012ab2d939f809","signature":"aa4d6dc9282133162a76109d99c5795583276c4fd27284f128d484acf12b0841"},"131b7f32092aa78e12fcb2a6db7c71e17f85e076c0635ad8d991b80d10130c19",{"version":"be3a09b63c0d3639c5fd497ed6d3f00fa61ba633e74b841108844ee3b3ff3f47","signature":"d1c84af1e6d5fa4a5f4badd45b03b67c9255a675df235a3ec25307a0f5524278"},{"version":"22f6df7b5f345f4934e261e6b3923d5d28ebf3049349ac8f2921311527217f55","signature":"cd28efe88fac7a92f3f5cfc7dd3c764f0b31bdaaa061ff044de1639810d6a7da"},{"version":"2341c1f3e039d9c25368a901d6c7e64d3743cc2d6b6c4a15fb8f1d194d3c8149","signature":"3355c4c572f076ad963d95f0e28075b8558e2ab492c84eb94f9e2c48f1c2368b"},"cd60a513d4653eb2e9c95b3351cbad232238f140c3eb4f3d48e93ceff7dd7bf7","f3787e74811e0328d91ebf9c1662a50501f457e2df45f53d85b3846c09d015ea","fc670c1c1c1b74b85d4305ea97d18292184b434c7168d40ed60658e187d0e40d",{"version":"e3fc829c75c12182fdad28349413c986d3de96abfd44612d9f4c7668e0f0564f","signature":"5638cfd48b0c56bc9ed0c779d53a40b92c9cd9c9d6312e3a21c52542d38094f3"},"827eb54656695635a6e25543f711f0fe86d1083e5e1c0e84f394ffc122bd3ad7","2309cee540edc190aa607149b673b437cb8807f4e8d921bf7f5a50e6aa8d609c","908a84aef7827422ff7c8623c661bcf2bcb0cb7a30aea39e82a79bbc09042ef6",{"version":"02e8e7131fc1abd33966d638fe9d7aacd18cd63b4310c8cc94d90e8bf9156557","signature":"703509e96cc30dce834ef8188c958c69306473b8a7e5cb3a6f324cee05a1f7bb"},{"version":"0f2be331f7b616109c9bde1fffb31ba7b34efccefe33d4f049735124a273ab4b","signature":"08e0ac95e650bd4c87145b6ab2257b70c06254bf76a0b9f8a7d60c51fb8ed6b8"},"c7d095626fe7d891fdd339ff01cc1d11eae282ca968059f8f3b39a697d8d452b",{"version":"a17d45077b1f4365945d9a515c9f46d3d19bba48b95e34e328c8bba6b5185181","signature":"4b57ec505a035491c692b89af2c6902c312ec22f8fa9b6dae3e93686659fb7e0"},{"version":"d7b7b7bcac03a91ce4f8c1eabe83c37036114662eadab96fbabae768e1572dc9","signature":"7d796672940d3b2d37f2edea4d7bcf4c7993966286006228cbc8fa35ac92871d"},{"version":"cc1d59cb69be74559bf501288731dfdd6b26290c683b20d0f4a0b97f1155d35a","signature":"132fd53917ed7f55275faa52c35e4d4d41e9576fea231d12740b723df2bade93"},{"version":"46dc802039939c036e50a52614744faffaf27060c6bb3a29220311368f7148c7","signature":"de2ecf9b1d6f60338f7b59b6f593ef77af9abd0e70ba8f2942953d0c6e1850af"},{"version":"602d0bbd01b7a0eb6492595cf73d2166d7b8e00fbfb7b0eb82b14e785836513c","signature":"6e503f5e906174df62cf3c7612497591a1dbb63110cdc524f0735a2016a6ad2e"},{"version":"eb9bf627ec34fa295918db1bda351063cad08bb68757a97f50e073c7c2c94da4","signature":"a3b13d166f97ae5900ad6a5b66ecdbb209378d434eca8ea6fc4d6e272b4c2472"},{"version":"c8ce89733658f16c006cf1a0e8f7afd9eaefd35833e46c59af91ee95346be98c","signature":"178e2de7a8702742957ad24deaeddec84a48cd913b5d932b16afd2a707b3e416"},{"version":"7425a64e36c402c1816a0b6aeddbc5d7c0e61b44374c81d949fc9c496ef88975","signature":"6eef4d0ee338cea465480c9cbd575df6f78d47fe0c2df1cd09fadcb7849e10cb"},"95d83d3380f931b477b8001183e8f3166db7b1d49df14466bf90693e223b82b8",{"version":"8162d174e958039d00a43ae124b4e92420f605bbbb409e4da90ebde9970c04ea","signature":"e53d21a2061c7b91944dfebec59bed2ce24ab165f984e3bae0f3a7a9f6c0458e"},{"version":"8a4ebbbdce06d6785bcfbf5cfcba1b3d05379598b9cb4770b04946dbfd30aef0","signature":"6829629d578b001051fb6dc2fb4976fbce015c04666b5a73d97335e003a75f7e"},{"version":"97ccba1e29159b5da70c069808b7d3121abe83f84cbe74d094fc1e5a37b800ac","signature":"53968130af2a091c147ddbdd9c8cfa19e083dd154584d5bef39ad25535650c35"},{"version":"58286a01aa6026d6f7c2bd248cf9af42fb1a0d7ed352becbf7a0de2f8250bb26","signature":"2b1c59d30d4fc731698e792c36c4ed4785966cc00f878c30294aa9b1b042b891"},{"version":"cd8a558b5ce73c6580fc947734e0dc4de24c551ba24a5c4b70eb90524b377378","signature":"27ca878cf70b3030e8403f51ce65949d364fa776d6dae3527f91635a40836672"},{"version":"462a03a5c9312455ef9c84127eb4fd79ba9736bbbbda4bd9f4b76e462d15c94b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"b3de90af7d32d321bba3a0769175f1d2669f13b9e6761a1258ab3a5c0840071d","signature":"d5bbd453310990e851908183fbbef9e6e2db8e0c86d97b42b723fd5238f71c81"},"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2",{"version":"172ab91e087451998f5ecf6f0f533ea89e337d24b6163defe5194899272e3df7","signature":"639f9321a98b734242a3573764d7f1de5369b0b0b10c768ae37639e8bda5dd03"},{"version":"5ba73b9bf3ca8f8c04f970c6618d5d54c3533c84f71ffb8541ded9a13b872a93","signature":"9c79ace686f720f4dd833740f7190e12cdce363362c982c164745527a412ef40"},{"version":"35c5398ee20fc33eaeed9ddc5086bfe780c41852c6ae0fd937069b991cded7d2","signature":"95e76bed30f6e993e1fcc1b90a4675682e4800ae43403547a775d6e3c7ab2b0f"},"75b22c74010ba649de1a1676a4c4b8b5bb4294fecd05089e2094429b16d7840c","4df0891b133884cd9ed752d31c7d0ec0a09234e9ed5394abffd3c660761598db","b603b62d3dcd31ef757dc7339b4fa8acdbca318b0fb9ac485f9a1351955615f9","e642bd47b75ad6b53cbf0dfd7ddfa0f120bd10193f0c58ec37d87b59bf604aca","be90b24d2ee6f875ce3aaa482e7c41a54278856b03d04212681c4032df62baf9","78f5ff400b3cb37e7b90eef1ff311253ed31c8cb66505e9828fad099bffde021","372c47090e1131305d163469a895ff2938f33fa73aad988df31cd31743f9efb6","71c67dc6987bdbd5599353f90009ff825dd7db0450ef9a0aee5bb0c574d18512","6f12403b5eca6ae7ca8e3efe3eeb9c683b06ce3e3844ccfd04098d83cd7e4957","282c535df88175d64d9df4550d2fd1176fd940c1c6822f1e7584003237f179d3","c3a4752cf103e4c6034d5bd449c8f9d5e7b352d22a5f8f9a41a8efb11646f9c2","11a9e38611ac3c77c74240c58b6bd64a0032128b29354e999650f1de1e034b1c","4ed103ca6fff9cb244f7c4b86d1eb28ce8069c32db720784329946731badb5bb","d738f282842970e058672663311c6875482ee36607c88b98ffb6604fba99cb2a","ec859cd8226aa623e41bbb47c249a55ee16dc1b8647359585244d57d3a5ed0c7","8891c6e959d253a66434ff5dc9ae46058fb3493e84b4ca39f710ef2d350656b1","c4463cf02535444dcbc3e67ecd29f1972490f74e49957d6fd4282a1013796ba6","0cb0a957ff02de0b25fd0f3f37130ca7f22d1e0dea256569c714c1f73c6791f8","2f5075dc512d51786b1ba3b1696565641dfaae3ac854f5f13d61fa12ef81a47e","ca3353cc82b1981f0d25d71d7432d583a6ef882ccdea82d65fbe49af37be51cb","50679a8e27aacf72f8c40bcab15d7ef5e83494089b4726b83eec4554344d5cdc","45351e0d51780b6f4088277a4457b9879506ee2720a887de232df0f1efcb33d8","5d697a4b315cc5bb3042ae869abffd10c3b0d7b182cda0e4c45d8819937e5796","563fa27fdaec8f195b84f71a7af0ef48d30d5cc830575db86da86a63a470c8e6","6ee58aa536dabb19b09bc036f1abe83feb51e13d63b23d30b2d0631a2de99b8f","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","299567f84bfedd1468dca2755a829cb19e607a6811673788807dc8921e211bc9","795d9fb85aad92221504db74dd179b506bd189bba0c104426f7e7bb8a66ffee5","1311bc194e0a69fe61031e852c1c0b439e2a2a3d1d5e2d8ff795499b9f283459","4b7ce19369d7e7fae76720c2c6c7f671bf3fa0f7093edb864f1ac358ca7c456c","c972ef44deca1fa8fab465915ffa00f82e126aacf3dfc8979c03b1b066ce5bb6","30285a1011c6d6b52f3ba3abb0a984be8148c05cdefb8eb6eb562335a3991f35","29c188a2c660f99f1b4835022e011c4268d7af989d4b7dda33c0a69ca1a777f8","1ed0bf138e87912d741e28333b58cbf814ae863783b3b404d2454cbabb9c5fc0","3452ee7d8ef0b1bbd47b2a56924a1dc3c79dc84a19d212e9dc496f92e4943aa0","22a21e410a4bf4817ac3b09ab90c51ec5f031edbf2e92a19b6c4832068e1f4c7","612d8ed678ed9c884c875823a72786d4820f84daff536b9ec1e4d9c829a6c66a","62c5c0c428ebac0044c4ae96900ef3da283abcdc76659ce337c720e5e92eb2f4","9bdc5cea7e3bfb096ad8ff730bfb737d922c2a83aeb5253cc1c5bd50115b0fee","55e7b39026dd9cd7b6c68be0a105b5e14063a9bdb8621d385bfb7c468ccebbbe","6963765b0ee8f9ccbcf3e6c85c0e1edc1307d9960b107368e6dff19e9170b444","b599eb810af9ddaba3d57749757c76be8f1095d3d7804984bfe879d25dc85368","e21a6a522121e5dd6c6cdf2a0d8980cd11e2ff1191c2ef05819c300fdd3b25a3","fc68efc28f7783d4756b053f6811fd63d6c4ab4717fd102c638c6471f969093e","2518ed2149cfdb36f7e9bc29561a0d1813d491e2ae78baa7cba49c578b354a27","2d2f0202995cb6116376960f788a6a0df5fe2a38b766de86632295f86d29a058","d160fe745f9c3b72d7b9036fdb2b6b500a520d43e36bb842c927b6fe59ea2c23",{"version":"5a438d8dd13b7ce91cd68cedab414e84604e0bf7c76d2cc2ad7a3207e9dda440","signature":"a17e6861b709149f29a2bd896cee94526df2f06b24a2b60614b56649b5e9aabe"},"97040b190f0daa10cf9a15e51a2fac66b26ddefd7b65998bd6027d1dd67647b7","877c25dfae100e555014e45d1d80364496a0c876201e5dea91a0fd0a6a4ff765","6c360ff81ea615810619342d67cea417bb971ada8961ac1aa86c23aff366c58f","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24",{"version":"2217890e61f53e5ac918472ee67f09d3e18b6c83986cd44c31fad5ee810ab997","signature":"23d98226adf3be74e1f0470f85e7fd154cd7aa979d60b43190a7437f0d0426eb"},{"version":"b3fb2293c781a3a174159c616d93adb55f46c915441405e8ab1ec4562fe33414","signature":"439850ca5075c6db55487b2c7fb27a6051fecbf180eee0809b67bb2783a89813"},"75d48857bc4216880443a24d985071262bb8b89a9952c77fd430cb0caa21f9bf",{"version":"3fb089f76b256567da25cced75215c7cdb7c213400848740428ce749607db7d2","signature":"33e40cf77499b3d9712db82e15683373925e85817dbe82a24ee0ee6e44bffb70"},{"version":"a910cbedfe51553a96820818e2c48f1aaa3610b5ecd65990b88c81fb46cc5be4","signature":"d53f9f96afd41359edeb2d5ad98559f3bfad261391d5aef95320fefb0c6a8742"},{"version":"c5a40716a6e879171815bebc71f2dd3bca58c790c7b20a6b8b9733b2ed58319c","signature":"16ac17bcf66fdebd02020be1b452396716134d7a281511bec775f9bec7e04200"},{"version":"7d67bee4b7f9b3390bf729b78390f5b6f8f9ce38753d8180bcfbe92845b8399d","signature":"8b206b995edc6dd849b85c1c56531b9780e3ba75302fd02a2d173f008028707e"},"e5fd6e6b32089a499bafbc66ddae09d7c3c8d7e9c4148d2fd0528ed1fe0c622a",{"version":"825778d44a20eb3346d3e818a560a58cd336505e7c22b020fae2e4c9f75f3ab8","signature":"a42c39d8b7d1b1eccb69c7919ea60dcc2670ea672a0af90b70a730974ec0e9fb"},{"version":"2728e8b5d218e1a32e0ef8f5462ecfb30861c1b3566acfffbbed2917a7ea1d98","signature":"dc5fe5f6b39c3fdfaeba333bcd5f0cc98bb3068797a4d7010f585366f549ddf7"},"2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab",{"version":"fe21efb975396ae12c2d5c30a5655e1a526718be9db1b92f3d0d5be69b2733a4","signature":"4a3ab8cb278bfd1f18f24cc45a02188b63afa6aef50035df6d79c4638f24059a"},"e724c9ce92f2a8a31ed260764c5455852a13d292e2a31d26acc6840ec0e83208","37ffe3c12813b6a6d512f7c27b71f3388d03dafa10555ad5094cea393ed3d1f6",{"version":"f2b5bdb6a68f7639e080ddfca8902b4c3cb9a73e2130494a245b151f491040a8","signature":"ed2b7ce9544f75d9aece6f8ed250b7c7048c3067de906c2c9f2e68d632b8fdcc"},{"version":"93fdd3d31ad2e6dd70a2389be7890cd88d9610e5ad782ec4bb4a9d6b6a0a9dc3","signature":"78889389420cbcbbe4146345a54cc896a88aa27fbaf759dc9235f1bc66c01a19"},"62af44d31faa5b32c9b29579330556a5340cecbd9d6326d236ed94c3d1667c2c","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3",{"version":"beb6b19b51d467d5e4f59b7c695f8f82c2e936c25680fc8e160c6feeb335e51c","signature":"c6daa2b36f9950e2ff6bb0138fc2f63a9dfd6e36c1aec88c47e7d06d6ead2d99"},{"version":"568173dcc3cf1a6238056cf96d84e1a31ea310a2a36ceb119e38cf52fb29afa2","signature":"49e2beeee0d4fe340562124e5e9a39d2afacaf567a78d08aad7226457a1aa9ae"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,436],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,181,349],[108,360,361],[108,154,345,346,347],[108,346],[108,347],[108,328,346,347,348],[108,350],[108,350,351,354,358],[108,357],[108,154,352,353],[108,154,187],[108,154,188],[108,188,189,190,191,192,193],[108,208,217,218,221],[108,208,217,220],[108,208,217,219,221],[108,209,212,213,215],[108,209,210,211],[108,212,213,215,216],[108,209,210,214],[108,220,226],[108,208,217,220,226],[108,217,220,226],[108,217,220,222,223,224,225],[108,208,217,218,219,220,221,226],[108,208,217],[108,154,366],[108,154,349,359,364,365,367],[108,154,349,359,362,363,364,366,367],[108,154,349,365],[108,154,181,366],[108,364,365,366,367,368,369,373],[108,154,194,374],[108,365,366,369],[108,154,370,371,372,374],[108,366,369],[108,154,366,369],[108,154,194,366,367],[108,154,187,194,195],[108,196],[108,115,154,196,199,200],[108,115,154,187,194,196,199],[108,200],[108,195,196,197,200,201,202,203,204],[108,115,197,199,202],[108,195,202],[108,154,194],[108,154,177],[108,177,178],[108,177,178,179,180],[108,154],[50,108,154,376],[50,108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,209],[108,298],[108,298,299],[108,355,356],[108,436,437,438,439,440],[108,436,438],[81,108,115,445],[72,108,115],[108,115,448],[108,450],[108,451,452,454],[96,108,115],[107,108,115,461],[81,108,115],[108,144],[108,467,468],[108,465,466,467],[78,81,108,115,458,459,460],[108,446,460,461,472],[108,453],[78,108,115,476],[79,108,115],[108,480],[108,486],[78,81,83,86,96,107,108,115],[108,491],[108,491,493],[108,492],[108,498,503],[108,496,499],[108,496,499,500,501],[108,498],[108,324,502],[108,497],[78,108,110,115,517,518,520],[108,519],[108,534],[108,522,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,525,526,527,528,529,530,531,532,533,534],[108,523,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,524,526,527,528,529,530,531,532,533,534],[108,522,523,524,525,527,528,529,530,531,532,533,534],[108,522,523,524,525,526,528,529,530,531,532,533,534],[108,522,523,524,525,526,527,529,530,531,532,533,534],[108,522,523,524,525,526,527,528,530,531,532,533,534],[108,522,523,524,525,526,527,528,529,531,532,533,534],[108,522,523,524,525,526,527,528,529,530,532,533,534],[108,522,523,524,525,526,527,528,529,530,531,533,534],[108,522,523,524,525,526,527,528,529,530,531,532,534],[108,522,523,524,525,526,527,528,529,530,531,532,533],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,486,544],[108,544,545,546,547,548],[108,482,483,484,485],[108,115,198],[79,108,115,477],[108,390,429],[108,390,414,429],[108,429],[108,390],[108,390,415,429],[108,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428],[108,415,429],[79,96,108,115,457],[79,81,108,115],[79,108,473],[81,108,115,471],[108,471],[108,470],[108,115,564,565,566,567,568,569,570,571,572,573,574],[108,563,564,573],[108,564,573],[108,557,563,564,573],[108,564],[71,108,563,573],[108,563,564,565,566,567,568,569,570,571,572,574],[78,81,83,96,104,107,108,113,115],[108,578],[78,96,108,115],[108,303],[108,302],[108,340],[108,340,341,342,343,344],[108,329,330,331,332,333,334,335,336,337,338,339],[108,476],[108,474,475],[108,506],[108,505,506],[108,505],[108,505,506,507,509,510,513,514,515,516],[108,506,510],[108,505,506,507,509,510,511,512],[108,505,510],[108,510,514],[108,506,507,508],[108,507],[108,505,506,510],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,115,154,182],[108,154,282],[108,251],[108,154,182,251,279,282,286,287],[108,115,154,181,182],[108,183,184,185,186,280,281],[44,50,108,279],[44,50,108,185],[108,155],[108,155,167],[108,155,156,169,171],[108,155,167,170],[108,155,161],[108,155,160,162],[108,160,161,162,163],[108,165,166],[108,156,157,158,159,164,167,168,169,170,171,172,173],[108,155,174,175,176,283],[108,155,174,282],[108,266],[108,279],[108,269,270,271,272,273,274,275,276,277],[108,154,228],[108,251,275,282],[108,228,279,282],[108,228,229,252,255,265,266,267,278],[50,108,251,284],[108,279,282],[108,227,229],[108,229],[108,282],[108,252],[108,154,255],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,264],[108,154,257],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,282],[108,154,227,228],[108,205,265],[108,154,229],[108,249],[50,108,236],[108,237,238,239,240,241,242,243,244,245,246,247,248],[108,236,249,250],[108,284],[108,154,284,288,295],[108,154,284,293,294],[108,154,284,292],[108,154,284,293,294,300],[50,108,154,284,304],[108,284,290],[108,227,284,285,307],[108,154,181,284,288],[79,108,284,311,312],[67,88,108,154,284,317],[79,87,88,108,154,284,294,314,316],[50,108,284,288,311],[108,154,284,288,294],[108,284,321],[108,284,310,311,319,321,323,327,384],[108,284,285,291,293,294,295,296,297,301,305,306,308,309,310,311,314,319,321,323,325,326,327,375,380,382,383,384,386,388,389,430],[50,108,154,284,374],[108,154,284],[50,108,284,288,294,314,382],[108,284,381],[79,88,108,154,284,288,291,316,317,320,380,381,384,432,433],[108,284,382,434],[50,108,154,227,284,285,288,305,309,326,327,375,380,384],[71,78,108,284,306],[50,108,284,288,326],[108,284,312,316,317,318,431,433,435,442],[108,284,320,381,383,384,434],[108,284,436,441],[50,108,154,284,288,289,294,297,301,374,377,378,379,381,383,384],[44,50,108,154,284,288,324,325],[50,108,154,284,294,297,319,382,383],[108,154,284,288,387],[108,284,320,380,381,383,384],[50,108,154,284,429],[108,154,284,289,291],[108,284,292],[108,284,294,315],[79,108,284,292],[288],[294],[292],[50,154,304],[227],[154,181,288],[154,294],[50,284,288,311],[310,311,319,321,323,327,384],[50,154,374],[154],[50,154,288,294,382],[145],[154,316,380,381,384],[50,154,227,288,326],[50,288,326],[312,316,317,318,431,433,435,442],[384],[50,288,374,377,381,383,384],[44,50],[50,154,294,297,319,382,383],[284,288],[79,292]],"referencedMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[285,272],[296,273],[295,274],[293,275],[297,272],[301,276],[305,277],[291,278],[306,272],[308,279],[309,272],[310,280],[313,281],[318,282],[317,283],[311,272],[319,284],[320,285],[322,286],[321,272],[385,287],[431,288],[375,289],[314,290],[383,291],[323,290],[382,292],[434,293],[435,294],[381,295],[312,296],[327,297],[443,298],[433,299],[386,290],[442,300],[380,301],[325,272],[326,302],[384,303],[388,304],[389,305],[430,306],[292,307],[294,308],[316,309],[315,310]],"exportedModulesMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[296,311],[295,312],[293,313],[301,312],[305,314],[308,315],[310,316],[317,317],[319,318],[320,312],[385,319],[431,288],[375,320],[314,321],[383,322],[323,323],[382,292],[434,324],[435,294],[381,325],[327,326],[443,327],[433,328],[380,329],[326,330],[384,331],[388,332],[389,328],[430,321],[294,308],[316,309],[315,333]],"semanticDiagnosticsPerFile":[438,436,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,360,361,362,328,348,347,346,349,351,359,358,350,354,352,188,189,190,191,192,194,193,219,221,220,208,216,212,213,217,215,222,223,224,226,225,227,218,367,366,365,364,368,374,363,370,373,371,372,369,196,197,202,200,201,205,203,204,195,178,180,179,181,177,187,307,377,376,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,211,209,210,214,299,300,298,289,355,357,356,444,441,437,439,440,353,446,447,449,452,451,455,456,462,445,463,145,464,469,465,468,467,461,473,454,453,477,478,479,450,481,487,488,489,490,448,491,492,494,495,504,496,500,502,501,499,503,498,497,519,520,466,521,535,523,524,522,525,526,527,528,529,530,531,532,533,534,536,457,537,538,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,539,540,541,484,542,460,459,543,545,547,544,546,548,549,482,486,199,198,550,551,552,553,485,414,415,390,393,412,413,403,402,400,395,408,406,410,394,407,411,396,397,409,391,398,399,401,405,416,404,392,429,428,423,425,424,417,418,420,422,426,427,419,421,458,554,555,472,470,471,556,557,558,559,518,480,560,379,561,562,575,574,565,566,567,568,569,570,571,564,572,573,563,576,577,578,579,580,118,324,304,302,303,483,432,378,339,336,338,337,335,345,340,344,341,343,342,331,332,333,329,330,334,387,474,476,475,507,516,505,506,517,512,513,511,515,509,508,514,510,290,493,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,286,182,287,288,183,184,185,282,280,186,281,155,156,157,158,159,168,169,170,172,173,171,160,162,163,161,164,165,166,167,174,284,176,175,283,228,267,269,270,278,271,272,273,274,276,275,277,268,279,252,206,207,230,231,232,233,234,235,253,254,256,265,258,257,259,260,264,261,262,263,229,266,255,250,237,246,238,239,248,240,241,249,247,242,245,243,244,251,236,285,296,295,293,297,301,305,291,306,308,309,310,313,318,317,311,319,320,322,321,385,431,375,314,383,323,382,434,435,381,312,327,443,433,386,442,380,325,326,384,388,389,430,292,294,316,315],"latestChangedDtsFile":"./types/node.d.ts"},"version":"4.8.4"} +\ No newline at end of file ++{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../../snaps-sdk/dist/types/jsx/component.d.ts","../../snaps-sdk/dist/types/jsx/components/Address.d.ts","../../snaps-sdk/dist/types/jsx/components/Box.d.ts","../../snaps-sdk/dist/types/jsx/components/Copyable.d.ts","../../snaps-sdk/dist/types/jsx/components/Divider.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Button.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Input.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Field.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Form.d.ts","../../snaps-sdk/dist/types/jsx/components/form/index.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Bold.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Italic.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/index.d.ts","../../snaps-sdk/dist/types/jsx/components/Heading.d.ts","../../snaps-sdk/dist/types/jsx/components/Image.d.ts","../../snaps-sdk/dist/types/jsx/components/Link.d.ts","../../snaps-sdk/dist/types/jsx/components/Text.d.ts","../../snaps-sdk/dist/types/jsx/components/Row.d.ts","../../snaps-sdk/dist/types/jsx/components/Spinner.d.ts","../../snaps-sdk/dist/types/jsx/components/index.d.ts","../../snaps-sdk/dist/types/jsx/jsx-runtime.d.ts","../../snaps-sdk/dist/types/jsx/jsx-dev-runtime.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../../snaps-sdk/dist/types/errors.d.ts","../../snaps-sdk/dist/types/internals/error-wrappers.d.ts","../../snaps-sdk/dist/types/internals/errors.d.ts","../../snaps-sdk/dist/types/internals/helpers.d.ts","../../snaps-sdk/dist/types/internals/structs.d.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../../snaps-sdk/dist/types/types/methods/create-interface.d.ts","../../snaps-sdk/dist/types/types/methods/dialog.d.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../../snaps-sdk/dist/types/types/caip.d.ts","../../snaps-sdk/dist/types/types/permissions.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-public-key.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip44-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-client-status.d.ts","../../snaps-sdk/dist/types/types/methods/get-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-file.d.ts","../../snaps-sdk/dist/types/ui/nodes.d.ts","../../snaps-sdk/dist/types/ui/components/address.d.ts","../../snaps-sdk/dist/types/ui/components/copyable.d.ts","../../snaps-sdk/dist/types/ui/components/divider.d.ts","../../snaps-sdk/dist/types/ui/components/heading.d.ts","../../snaps-sdk/dist/types/ui/components/image.d.ts","../../snaps-sdk/dist/types/ui/components/panel.d.ts","../../snaps-sdk/dist/types/ui/components/spinner.d.ts","../../snaps-sdk/dist/types/ui/components/text.d.ts","../../snaps-sdk/dist/types/ui/components/row.d.ts","../../snaps-sdk/dist/types/ui/components/button.d.ts","../../snaps-sdk/dist/types/ui/components/input.d.ts","../../snaps-sdk/dist/types/ui/components/form.d.ts","../../snaps-sdk/dist/types/ui/components/index.d.ts","../../snaps-sdk/dist/types/ui/component.d.ts","../../snaps-sdk/dist/types/ui/index.d.ts","../../snaps-sdk/dist/types/types/interface.d.ts","../../snaps-sdk/dist/types/types/methods/get-interface-state.d.ts","../../snaps-sdk/dist/types/types/methods/get-locale.d.ts","../../snaps-sdk/dist/types/types/snap.d.ts","../../snaps-sdk/dist/types/types/methods/get-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-snap.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-keyring.d.ts","../../snaps-sdk/dist/types/types/methods/manage-accounts.d.ts","../../snaps-sdk/dist/types/types/methods/manage-state.d.ts","../../snaps-sdk/dist/types/types/methods/notify.d.ts","../../snaps-sdk/dist/types/types/methods/request-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/update-interface.d.ts","../../snaps-sdk/dist/types/types/methods/methods.d.ts","../../snaps-sdk/dist/types/types/methods/index.d.ts","../../snaps-sdk/dist/types/types/provider.d.ts","../../snaps-sdk/dist/types/types/global.d.ts","../../snaps-sdk/dist/types/types/images.d.ts","../../snaps-sdk/dist/types/types/handlers/cronjob.d.ts","../../snaps-sdk/dist/types/types/handlers/home-page.d.ts","../../snaps-sdk/dist/types/types/handlers/keyring.d.ts","../../snaps-sdk/dist/types/types/handlers/lifecycle.d.ts","../../snaps-sdk/dist/types/types/handlers/name-lookup.d.ts","../../snaps-sdk/dist/types/types/handlers/rpc-request.d.ts","../../snaps-sdk/dist/types/types/handlers/transaction.d.ts","../../snaps-sdk/dist/types/types/handlers/signature.d.ts","../../snaps-sdk/dist/types/types/handlers/user-input.d.ts","../../snaps-sdk/dist/types/types/handlers/index.d.ts","../../snaps-sdk/dist/types/types/index.d.ts","../../snaps-sdk/dist/types/internals/jsx.d.ts","../../snaps-sdk/dist/types/internals/svg.d.ts","../../snaps-sdk/dist/types/internals/index.d.ts","../../snaps-sdk/dist/types/jsx/validation.d.ts","../../snaps-sdk/dist/types/jsx/index.d.ts","../src/array.ts","../../snaps-sdk/dist/types/error-wrappers.d.ts","../../snaps-sdk/dist/types/images.d.ts","../../snaps-sdk/dist/types/index.d.ts","../../../node_modules/@scure/base/lib/index.d.ts","../../../node_modules/rfdc/index.d.ts","../src/deep-clone.ts","../src/virtual-file/VirtualFile.ts","../src/bytes.ts","../src/virtual-file/index.ts","../src/base64.ts","../src/auxiliary-files.ts","../src/caveats.ts","../../../node_modules/@noble/hashes/utils.d.ts","../../../node_modules/@noble/hashes/_md.d.ts","../../../node_modules/@noble/hashes/sha256.d.ts","../src/checksum.ts","../../../node_modules/cron-parser/types/common.d.ts","../../../node_modules/cron-parser/types/index.d.ts","../../../node_modules/cron-parser/index.d.ts","../src/cronjob.ts","../src/default-endowments.ts","../../../node_modules/@metamask/slip44/slip44.json","../src/derivation-paths.ts","../src/entropy.ts","../src/errors.ts","../src/handler-types.ts","../src/mock.ts","../src/eval-worker.ts","../src/json.ts","../src/virtual-file/toVirtualFile.ts","../src/virtual-file/node.ts","../src/fs.ts","../src/eval.ts","../src/handlers.ts","../src/icon.ts","../src/iframe.ts","../src/iframe.test.browser.ts","../src/logging.ts","../../../node_modules/chalk/index.d.ts","../src/strings.ts","../src/structs.ts","../src/namespace.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV1.d.ts","../../../node_modules/immer/dist/utils/env.d.ts","../../../node_modules/immer/dist/utils/errors.d.ts","../../../node_modules/immer/dist/types/types-external.d.ts","../../../node_modules/immer/dist/types/types-internal.d.ts","../../../node_modules/immer/dist/utils/common.d.ts","../../../node_modules/immer/dist/utils/plugins.d.ts","../../../node_modules/immer/dist/core/scope.d.ts","../../../node_modules/immer/dist/core/finalize.d.ts","../../../node_modules/immer/dist/core/proxy.d.ts","../../../node_modules/immer/dist/core/immerClass.d.ts","../../../node_modules/immer/dist/core/current.d.ts","../../../node_modules/immer/dist/internal.d.ts","../../../node_modules/immer/dist/plugins/es5.d.ts","../../../node_modules/immer/dist/plugins/patches.d.ts","../../../node_modules/immer/dist/plugins/mapset.d.ts","../../../node_modules/immer/dist/plugins/all.d.ts","../../../node_modules/immer/dist/immer.d.ts","../../../node_modules/@metamask/base-controller/dist/types/RestrictedControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/ControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV2.d.ts","../../../node_modules/@metamask/base-controller/dist/types/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/types.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/constants.d.ts","../../../node_modules/@metamask/eth-query/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/util.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/abnf.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/utils.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/parsers.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/siwe.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/index.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/ApprovalController.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/permission-middleware.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/SubjectMetadataController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/PermissionController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Permission.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Caveat.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/utils.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/getPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/requestPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/revokePermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/index.d.ts","../src/json-rpc.ts","../../../node_modules/@metamask/snaps-registry/dist/verify.d.ts","../../../node_modules/@metamask/snaps-registry/dist/index.d.ts","../../../node_modules/fast-json-stable-stringify/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../src/snaps.ts","../src/manifest/validation.ts","../src/manifest/index.ts","../src/localization.ts","../src/types.ts","../src/index.executionenv.ts","../src/path.ts","../../../node_modules/marked/lib/marked.d.ts","../src/ui.tsx","../src/validation.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../src/versions.ts","../src/index.ts","../../../node_modules/fast-deep-equal/index.d.ts","../src/npm.ts","../src/manifest/manifest.ts","../src/manifest/node.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../src/post-process.ts","../src/node.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f","c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b","9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff","44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e","043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3","e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3","5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d","cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef","16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3","f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d","87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060","c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add","efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac","3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe","bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58","b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3","5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51","8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21","8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60","b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1","77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a","31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba","d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41","9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d","6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4","cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff","9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c","a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0","0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34","fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2","ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269","3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284","5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2","6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8","0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554","5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609","80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a","2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643","cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3","9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94","122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45","f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08","0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36","e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8","5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335","92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590","3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd","20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870","078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51","68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d","56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7","2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed","620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f","6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0","080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d","874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c","6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749","6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96","d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a","747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2","b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c","e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71","b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c","15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1","4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183","73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3","3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941","3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1","50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e","3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c","72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb","f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf",{"version":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e","9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c","aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1","150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2","cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20","47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a","6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47","afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228","df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494","03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88","11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0","cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc","959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383","6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0","2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232","1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563","58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3",{"version":"2f700dfc0b29df3605475fcd717c0fc759c95e42067c389cbb503ba3bde9b155","signature":"00abf32ca3af92f8be9ecbc9b63090b4909a756317d791927a83cffd24e9c8ac"},"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10","6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3","abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6","27e882f5d19aee4c49dbdebedbfa79c3233b874adcdcac46295232c4c1bcd13b","1ce746559c2b493ba53418bb35dcfb13b8581bed88c0ac484d92b004077c4b4e",{"version":"27d30b08ab92c978b5f2bbda4a242ea927f908287edce0c2ed11ddcf52c80e01","signature":"900daf04dc607dc3858c0f976d6f9e17b829a07de58d62dc6f730eaf06986075"},{"version":"26351dd9044d932d46fc6472737c5335df5b4a9ad5f1ee1c157d328beb6744f4","signature":"8b2100d3ba68063b7baf5038f26eefe46543dcebf1e7dbaf46277f24307cefcb"},{"version":"5a55c1d9a73f1a1867915a6f043c5d05a439291aec5482b918012ab2d939f809","signature":"aa4d6dc9282133162a76109d99c5795583276c4fd27284f128d484acf12b0841"},"131b7f32092aa78e12fcb2a6db7c71e17f85e076c0635ad8d991b80d10130c19",{"version":"be3a09b63c0d3639c5fd497ed6d3f00fa61ba633e74b841108844ee3b3ff3f47","signature":"d1c84af1e6d5fa4a5f4badd45b03b67c9255a675df235a3ec25307a0f5524278"},{"version":"22f6df7b5f345f4934e261e6b3923d5d28ebf3049349ac8f2921311527217f55","signature":"cd28efe88fac7a92f3f5cfc7dd3c764f0b31bdaaa061ff044de1639810d6a7da"},{"version":"2341c1f3e039d9c25368a901d6c7e64d3743cc2d6b6c4a15fb8f1d194d3c8149","signature":"3355c4c572f076ad963d95f0e28075b8558e2ab492c84eb94f9e2c48f1c2368b"},"cd60a513d4653eb2e9c95b3351cbad232238f140c3eb4f3d48e93ceff7dd7bf7","f3787e74811e0328d91ebf9c1662a50501f457e2df45f53d85b3846c09d015ea","fc670c1c1c1b74b85d4305ea97d18292184b434c7168d40ed60658e187d0e40d",{"version":"e3fc829c75c12182fdad28349413c986d3de96abfd44612d9f4c7668e0f0564f","signature":"5638cfd48b0c56bc9ed0c779d53a40b92c9cd9c9d6312e3a21c52542d38094f3"},"827eb54656695635a6e25543f711f0fe86d1083e5e1c0e84f394ffc122bd3ad7","2309cee540edc190aa607149b673b437cb8807f4e8d921bf7f5a50e6aa8d609c","908a84aef7827422ff7c8623c661bcf2bcb0cb7a30aea39e82a79bbc09042ef6",{"version":"02e8e7131fc1abd33966d638fe9d7aacd18cd63b4310c8cc94d90e8bf9156557","signature":"703509e96cc30dce834ef8188c958c69306473b8a7e5cb3a6f324cee05a1f7bb"},{"version":"0f2be331f7b616109c9bde1fffb31ba7b34efccefe33d4f049735124a273ab4b","signature":"08e0ac95e650bd4c87145b6ab2257b70c06254bf76a0b9f8a7d60c51fb8ed6b8"},"c7d095626fe7d891fdd339ff01cc1d11eae282ca968059f8f3b39a697d8d452b",{"version":"a17d45077b1f4365945d9a515c9f46d3d19bba48b95e34e328c8bba6b5185181","signature":"4b57ec505a035491c692b89af2c6902c312ec22f8fa9b6dae3e93686659fb7e0"},{"version":"d7b7b7bcac03a91ce4f8c1eabe83c37036114662eadab96fbabae768e1572dc9","signature":"7d796672940d3b2d37f2edea4d7bcf4c7993966286006228cbc8fa35ac92871d"},{"version":"cc1d59cb69be74559bf501288731dfdd6b26290c683b20d0f4a0b97f1155d35a","signature":"132fd53917ed7f55275faa52c35e4d4d41e9576fea231d12740b723df2bade93"},{"version":"46dc802039939c036e50a52614744faffaf27060c6bb3a29220311368f7148c7","signature":"de2ecf9b1d6f60338f7b59b6f593ef77af9abd0e70ba8f2942953d0c6e1850af"},{"version":"602d0bbd01b7a0eb6492595cf73d2166d7b8e00fbfb7b0eb82b14e785836513c","signature":"6e503f5e906174df62cf3c7612497591a1dbb63110cdc524f0735a2016a6ad2e"},{"version":"eb9bf627ec34fa295918db1bda351063cad08bb68757a97f50e073c7c2c94da4","signature":"a3b13d166f97ae5900ad6a5b66ecdbb209378d434eca8ea6fc4d6e272b4c2472"},{"version":"c8ce89733658f16c006cf1a0e8f7afd9eaefd35833e46c59af91ee95346be98c","signature":"178e2de7a8702742957ad24deaeddec84a48cd913b5d932b16afd2a707b3e416"},{"version":"7425a64e36c402c1816a0b6aeddbc5d7c0e61b44374c81d949fc9c496ef88975","signature":"6eef4d0ee338cea465480c9cbd575df6f78d47fe0c2df1cd09fadcb7849e10cb"},"95d83d3380f931b477b8001183e8f3166db7b1d49df14466bf90693e223b82b8",{"version":"8162d174e958039d00a43ae124b4e92420f605bbbb409e4da90ebde9970c04ea","signature":"e53d21a2061c7b91944dfebec59bed2ce24ab165f984e3bae0f3a7a9f6c0458e"},{"version":"8a4ebbbdce06d6785bcfbf5cfcba1b3d05379598b9cb4770b04946dbfd30aef0","signature":"6829629d578b001051fb6dc2fb4976fbce015c04666b5a73d97335e003a75f7e"},{"version":"97ccba1e29159b5da70c069808b7d3121abe83f84cbe74d094fc1e5a37b800ac","signature":"53968130af2a091c147ddbdd9c8cfa19e083dd154584d5bef39ad25535650c35"},{"version":"58286a01aa6026d6f7c2bd248cf9af42fb1a0d7ed352becbf7a0de2f8250bb26","signature":"2b1c59d30d4fc731698e792c36c4ed4785966cc00f878c30294aa9b1b042b891"},{"version":"cd8a558b5ce73c6580fc947734e0dc4de24c551ba24a5c4b70eb90524b377378","signature":"27ca878cf70b3030e8403f51ce65949d364fa776d6dae3527f91635a40836672"},{"version":"462a03a5c9312455ef9c84127eb4fd79ba9736bbbbda4bd9f4b76e462d15c94b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"b3de90af7d32d321bba3a0769175f1d2669f13b9e6761a1258ab3a5c0840071d","signature":"d5bbd453310990e851908183fbbef9e6e2db8e0c86d97b42b723fd5238f71c81"},"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2",{"version":"172ab91e087451998f5ecf6f0f533ea89e337d24b6163defe5194899272e3df7","signature":"639f9321a98b734242a3573764d7f1de5369b0b0b10c768ae37639e8bda5dd03"},{"version":"5ba73b9bf3ca8f8c04f970c6618d5d54c3533c84f71ffb8541ded9a13b872a93","signature":"9c79ace686f720f4dd833740f7190e12cdce363362c982c164745527a412ef40"},{"version":"35c5398ee20fc33eaeed9ddc5086bfe780c41852c6ae0fd937069b991cded7d2","signature":"95e76bed30f6e993e1fcc1b90a4675682e4800ae43403547a775d6e3c7ab2b0f"},"75b22c74010ba649de1a1676a4c4b8b5bb4294fecd05089e2094429b16d7840c","4df0891b133884cd9ed752d31c7d0ec0a09234e9ed5394abffd3c660761598db","b603b62d3dcd31ef757dc7339b4fa8acdbca318b0fb9ac485f9a1351955615f9","e642bd47b75ad6b53cbf0dfd7ddfa0f120bd10193f0c58ec37d87b59bf604aca","be90b24d2ee6f875ce3aaa482e7c41a54278856b03d04212681c4032df62baf9","78f5ff400b3cb37e7b90eef1ff311253ed31c8cb66505e9828fad099bffde021","372c47090e1131305d163469a895ff2938f33fa73aad988df31cd31743f9efb6","71c67dc6987bdbd5599353f90009ff825dd7db0450ef9a0aee5bb0c574d18512","6f12403b5eca6ae7ca8e3efe3eeb9c683b06ce3e3844ccfd04098d83cd7e4957","282c535df88175d64d9df4550d2fd1176fd940c1c6822f1e7584003237f179d3","c3a4752cf103e4c6034d5bd449c8f9d5e7b352d22a5f8f9a41a8efb11646f9c2","11a9e38611ac3c77c74240c58b6bd64a0032128b29354e999650f1de1e034b1c","4ed103ca6fff9cb244f7c4b86d1eb28ce8069c32db720784329946731badb5bb","d738f282842970e058672663311c6875482ee36607c88b98ffb6604fba99cb2a","ec859cd8226aa623e41bbb47c249a55ee16dc1b8647359585244d57d3a5ed0c7","8891c6e959d253a66434ff5dc9ae46058fb3493e84b4ca39f710ef2d350656b1","c4463cf02535444dcbc3e67ecd29f1972490f74e49957d6fd4282a1013796ba6","0cb0a957ff02de0b25fd0f3f37130ca7f22d1e0dea256569c714c1f73c6791f8","2f5075dc512d51786b1ba3b1696565641dfaae3ac854f5f13d61fa12ef81a47e","ca3353cc82b1981f0d25d71d7432d583a6ef882ccdea82d65fbe49af37be51cb","50679a8e27aacf72f8c40bcab15d7ef5e83494089b4726b83eec4554344d5cdc","45351e0d51780b6f4088277a4457b9879506ee2720a887de232df0f1efcb33d8","5d697a4b315cc5bb3042ae869abffd10c3b0d7b182cda0e4c45d8819937e5796","563fa27fdaec8f195b84f71a7af0ef48d30d5cc830575db86da86a63a470c8e6","6ee58aa536dabb19b09bc036f1abe83feb51e13d63b23d30b2d0631a2de99b8f","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","299567f84bfedd1468dca2755a829cb19e607a6811673788807dc8921e211bc9","795d9fb85aad92221504db74dd179b506bd189bba0c104426f7e7bb8a66ffee5","1311bc194e0a69fe61031e852c1c0b439e2a2a3d1d5e2d8ff795499b9f283459","4b7ce19369d7e7fae76720c2c6c7f671bf3fa0f7093edb864f1ac358ca7c456c","c972ef44deca1fa8fab465915ffa00f82e126aacf3dfc8979c03b1b066ce5bb6","30285a1011c6d6b52f3ba3abb0a984be8148c05cdefb8eb6eb562335a3991f35","29c188a2c660f99f1b4835022e011c4268d7af989d4b7dda33c0a69ca1a777f8","1ed0bf138e87912d741e28333b58cbf814ae863783b3b404d2454cbabb9c5fc0","3452ee7d8ef0b1bbd47b2a56924a1dc3c79dc84a19d212e9dc496f92e4943aa0","22a21e410a4bf4817ac3b09ab90c51ec5f031edbf2e92a19b6c4832068e1f4c7","612d8ed678ed9c884c875823a72786d4820f84daff536b9ec1e4d9c829a6c66a","62c5c0c428ebac0044c4ae96900ef3da283abcdc76659ce337c720e5e92eb2f4","9bdc5cea7e3bfb096ad8ff730bfb737d922c2a83aeb5253cc1c5bd50115b0fee","55e7b39026dd9cd7b6c68be0a105b5e14063a9bdb8621d385bfb7c468ccebbbe","6963765b0ee8f9ccbcf3e6c85c0e1edc1307d9960b107368e6dff19e9170b444","b599eb810af9ddaba3d57749757c76be8f1095d3d7804984bfe879d25dc85368","e21a6a522121e5dd6c6cdf2a0d8980cd11e2ff1191c2ef05819c300fdd3b25a3","fc68efc28f7783d4756b053f6811fd63d6c4ab4717fd102c638c6471f969093e","2518ed2149cfdb36f7e9bc29561a0d1813d491e2ae78baa7cba49c578b354a27","2d2f0202995cb6116376960f788a6a0df5fe2a38b766de86632295f86d29a058","d160fe745f9c3b72d7b9036fdb2b6b500a520d43e36bb842c927b6fe59ea2c23",{"version":"5a438d8dd13b7ce91cd68cedab414e84604e0bf7c76d2cc2ad7a3207e9dda440","signature":"a17e6861b709149f29a2bd896cee94526df2f06b24a2b60614b56649b5e9aabe"},"97040b190f0daa10cf9a15e51a2fac66b26ddefd7b65998bd6027d1dd67647b7","877c25dfae100e555014e45d1d80364496a0c876201e5dea91a0fd0a6a4ff765","6c360ff81ea615810619342d67cea417bb971ada8961ac1aa86c23aff366c58f","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24",{"version":"2217890e61f53e5ac918472ee67f09d3e18b6c83986cd44c31fad5ee810ab997","signature":"23d98226adf3be74e1f0470f85e7fd154cd7aa979d60b43190a7437f0d0426eb"},{"version":"b3fb2293c781a3a174159c616d93adb55f46c915441405e8ab1ec4562fe33414","signature":"439850ca5075c6db55487b2c7fb27a6051fecbf180eee0809b67bb2783a89813"},"75d48857bc4216880443a24d985071262bb8b89a9952c77fd430cb0caa21f9bf",{"version":"3fb089f76b256567da25cced75215c7cdb7c213400848740428ce749607db7d2","signature":"33e40cf77499b3d9712db82e15683373925e85817dbe82a24ee0ee6e44bffb70"},{"version":"a910cbedfe51553a96820818e2c48f1aaa3610b5ecd65990b88c81fb46cc5be4","signature":"d53f9f96afd41359edeb2d5ad98559f3bfad261391d5aef95320fefb0c6a8742"},{"version":"c5a40716a6e879171815bebc71f2dd3bca58c790c7b20a6b8b9733b2ed58319c","signature":"16ac17bcf66fdebd02020be1b452396716134d7a281511bec775f9bec7e04200"},{"version":"7d67bee4b7f9b3390bf729b78390f5b6f8f9ce38753d8180bcfbe92845b8399d","signature":"8b206b995edc6dd849b85c1c56531b9780e3ba75302fd02a2d173f008028707e"},"e5fd6e6b32089a499bafbc66ddae09d7c3c8d7e9c4148d2fd0528ed1fe0c622a",{"version":"825778d44a20eb3346d3e818a560a58cd336505e7c22b020fae2e4c9f75f3ab8","signature":"a42c39d8b7d1b1eccb69c7919ea60dcc2670ea672a0af90b70a730974ec0e9fb"},{"version":"2728e8b5d218e1a32e0ef8f5462ecfb30861c1b3566acfffbbed2917a7ea1d98","signature":"dc5fe5f6b39c3fdfaeba333bcd5f0cc98bb3068797a4d7010f585366f549ddf7"},"2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab",{"version":"fe21efb975396ae12c2d5c30a5655e1a526718be9db1b92f3d0d5be69b2733a4","signature":"4a3ab8cb278bfd1f18f24cc45a02188b63afa6aef50035df6d79c4638f24059a"},"e724c9ce92f2a8a31ed260764c5455852a13d292e2a31d26acc6840ec0e83208","37ffe3c12813b6a6d512f7c27b71f3388d03dafa10555ad5094cea393ed3d1f6",{"version":"f2b5bdb6a68f7639e080ddfca8902b4c3cb9a73e2130494a245b151f491040a8","signature":"ed2b7ce9544f75d9aece6f8ed250b7c7048c3067de906c2c9f2e68d632b8fdcc"},{"version":"93fdd3d31ad2e6dd70a2389be7890cd88d9610e5ad782ec4bb4a9d6b6a0a9dc3","signature":"78889389420cbcbbe4146345a54cc896a88aa27fbaf759dc9235f1bc66c01a19"},"62af44d31faa5b32c9b29579330556a5340cecbd9d6326d236ed94c3d1667c2c","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3",{"version":"beb6b19b51d467d5e4f59b7c695f8f82c2e936c25680fc8e160c6feeb335e51c","signature":"c6daa2b36f9950e2ff6bb0138fc2f63a9dfd6e36c1aec88c47e7d06d6ead2d99"},{"version":"568173dcc3cf1a6238056cf96d84e1a31ea310a2a36ceb119e38cf52fb29afa2","signature":"49e2beeee0d4fe340562124e5e9a39d2afacaf567a78d08aad7226457a1aa9ae"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,436],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,181,349],[108,360,361],[108,154,345,346,347],[108,346],[108,347],[108,328,346,347,348],[108,350],[108,350,351,354,358],[108,357],[108,154,352,353],[108,154,187],[108,154,188],[108,188,189,190,191,192,193],[108,208,217,218,221],[108,208,217,220],[108,208,217,219,221],[108,209,212,213,215],[108,209,210,211],[108,212,213,215,216],[108,209,210,214],[108,220,226],[108,208,217,220,226],[108,217,220,226],[108,217,220,222,223,224,225],[108,208,217,218,219,220,221,226],[108,208,217],[108,154,366],[108,154,349,359,364,365,367],[108,154,349,359,362,363,364,366,367],[108,154,349,365],[108,154,181,366],[108,364,365,366,367,368,369,373],[108,154,194,374],[108,365,366,369],[108,154,370,371,372,374],[108,366,369],[108,154,366,369],[108,154,194,366,367],[108,154,187,194,195],[108,196],[108,115,154,196,199,200],[108,115,154,187,194,196,199],[108,200],[108,195,196,197,200,201,202,203,204],[108,115,197,199,202],[108,195,202],[108,154,194],[108,154,177],[108,177,178],[108,177,178,179,180],[108,154],[50,108,154,376],[50,108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,209],[108,298],[108,298,299],[108,355,356],[108,436,437,438,439,440],[108,436,438],[81,108,115,445],[72,108,115],[108,115,448],[108,450],[108,451,452,454],[96,108,115],[107,108,115,461],[81,108,115],[108,144],[108,467,468],[108,465,466,467],[78,81,108,115,458,459,460],[108,446,460,461,472],[108,453],[78,108,115,476],[79,108,115],[108,480],[108,486],[78,81,83,86,96,107,108,115],[108,491],[108,491,493],[108,492],[108,498,503],[108,496,499],[108,496,499,500,501],[108,498],[108,324,502],[108,497],[78,108,110,115,517,518,520],[108,519],[108,534],[108,522,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,525,526,527,528,529,530,531,532,533,534],[108,523,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,524,526,527,528,529,530,531,532,533,534],[108,522,523,524,525,527,528,529,530,531,532,533,534],[108,522,523,524,525,526,528,529,530,531,532,533,534],[108,522,523,524,525,526,527,529,530,531,532,533,534],[108,522,523,524,525,526,527,528,530,531,532,533,534],[108,522,523,524,525,526,527,528,529,531,532,533,534],[108,522,523,524,525,526,527,528,529,530,532,533,534],[108,522,523,524,525,526,527,528,529,530,531,533,534],[108,522,523,524,525,526,527,528,529,530,531,532,534],[108,522,523,524,525,526,527,528,529,530,531,532,533],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,486,544],[108,544,545,546,547,548],[108,482,483,484,485],[108,115,198],[79,108,115,477],[108,390,429],[108,390,414,429],[108,429],[108,390],[108,390,415,429],[108,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428],[108,415,429],[79,96,108,115,457],[79,81,108,115],[79,108,473],[81,108,115,471],[108,471],[108,470],[108,115,564,565,566,567,568,569,570,571,572,573,574],[108,563,564,573],[108,564,573],[108,557,563,564,573],[108,564],[71,108,563,573],[108,563,564,565,566,567,568,569,570,571,572,574],[78,81,83,96,104,107,108,113,115],[108,578],[78,96,108,115],[108,303],[108,302],[108,340],[108,340,341,342,343,344],[108,329,330,331,332,333,334,335,336,337,338,339],[108,476],[108,474,475],[108,506],[108,505,506],[108,505],[108,505,506,507,509,510,513,514,515,516],[108,506,510],[108,505,506,507,509,510,511,512],[108,505,510],[108,510,514],[108,506,507,508],[108,507],[108,505,506,510],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,115,154,182],[108,154,282],[108,251],[108,154,182,251,279,282,286,287],[108,115,154,181,182],[108,183,184,185,186,280,281],[44,50,108,279],[44,50,108,185],[108,155],[108,155,167],[108,155,156,169,171],[108,155,167,170],[108,155,161],[108,155,160,162],[108,160,161,162,163],[108,165,166],[108,156,157,158,159,164,167,168,169,170,171,172,173],[108,155,174,175,176,283],[108,155,174,282],[108,266],[108,279],[108,269,270,271,272,273,274,275,276,277],[108,154,228],[108,251,275,282],[108,228,279,282],[108,228,229,252,255,265,266,267,278],[50,108,251,284],[108,279,282],[108,227,229],[108,229],[108,282],[108,252],[108,154,255],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,264],[108,154,257],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,282],[108,154,227,228],[108,205,265],[108,154,229],[108,249],[50,108,236],[108,237,238,239,240,241,242,243,244,245,246,247,248],[108,236,249,250],[108,284],[108,154,284,288,295],[108,154,284,293,294],[108,154,284,292],[108,154,284,293,294,300],[50,108,154,284,304],[108,284,290],[108,227,284,285,307],[108,154,181,284,288],[79,108,284,311,312],[67,88,108,154,284,317],[79,87,88,108,154,284,294,314,316],[50,108,284,288,311],[108,154,284,288,294],[108,284,321],[108,284,310,311,319,321,323,327,384],[108,284,285,291,293,294,295,296,297,301,305,306,308,309,310,311,314,319,321,323,325,326,327,375,380,382,383,384,386,388,389,430],[50,108,154,284,374],[108,154,284],[50,108,284,288,294,314,382],[108,284,381],[79,88,108,154,284,288,291,316,317,320,380,381,384,432,433],[108,284,382,434],[50,108,154,227,284,285,288,305,309,326,327,375,380,384],[71,78,108,284,306],[50,108,284,288,326],[108,284,312,316,317,318,431,433,435,442],[108,284,320,381,383,384,434],[108,284,436,441],[50,108,154,284,288,289,294,297,301,374,377,378,379,381,383,384],[44,50,108,154,284,288,324,325],[50,108,154,284,294,297,319,382,383],[108,154,284,288,387],[108,284,320,380,381,383,384],[50,108,154,284,429],[108,154,284,289,291],[108,284,292],[108,284,294,315],[79,108,284,292],[288],[294],[292],[50,154,304],[227],[154,181,288],[154,294],[50,284,288,311],[310,311,319,321,323,327,384],[50,154,374],[154],[50,154,288,294,382],[145],[154,316,380,381,384],[50,154,227,288,326],[50,288,326],[312,316,317,318,431,433,435,442],[384],[50,288,374,377,381,383,384],[44,50],[50,154,294,297,319,382,383],[284,288],[79,292]],"referencedMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[285,272],[296,273],[295,274],[293,275],[297,272],[301,276],[305,277],[291,278],[306,272],[308,279],[309,272],[310,280],[313,281],[318,282],[317,283],[311,272],[319,284],[320,285],[322,286],[321,272],[385,287],[431,288],[375,289],[314,290],[383,291],[323,290],[382,292],[434,293],[435,294],[381,295],[312,296],[327,297],[443,298],[433,299],[386,290],[442,300],[380,301],[325,272],[326,302],[384,303],[388,304],[389,305],[430,306],[292,307],[294,308],[316,309],[315,310]],"exportedModulesMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[296,311],[295,312],[293,313],[301,312],[305,314],[308,315],[310,316],[317,317],[319,318],[320,312],[385,319],[431,288],[375,320],[314,321],[383,322],[323,323],[382,292],[434,324],[435,294],[381,325],[327,326],[443,327],[433,328],[380,329],[326,330],[384,331],[388,332],[389,328],[430,321],[294,308],[316,309],[315,333]],"semanticDiagnosticsPerFile":[438,436,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,360,361,362,328,348,347,346,349,351,359,358,350,354,352,188,189,190,191,192,194,193,219,221,220,208,216,212,213,217,215,222,223,224,226,225,227,218,367,366,365,364,368,374,363,370,373,371,372,369,196,197,202,200,201,205,203,204,195,178,180,179,181,177,187,307,377,376,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,211,209,210,214,299,300,298,289,355,357,356,444,441,437,439,440,353,446,447,449,452,451,455,456,462,445,463,145,464,469,465,468,467,461,473,454,453,477,478,479,450,481,487,488,489,490,448,491,492,494,495,504,496,500,502,501,499,503,498,497,519,520,466,521,535,523,524,522,525,526,527,528,529,530,531,532,533,534,536,457,537,538,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,539,540,541,484,542,460,459,543,545,547,544,546,548,549,482,486,199,198,550,551,552,553,485,414,415,390,393,412,413,403,402,400,395,408,406,410,394,407,411,396,397,409,391,398,399,401,405,416,404,392,429,428,423,425,424,417,418,420,422,426,427,419,421,458,554,555,472,470,471,556,557,558,559,518,480,560,379,561,562,575,574,565,566,567,568,569,570,571,564,572,573,563,576,577,578,579,580,118,324,304,302,303,483,432,378,339,336,338,337,335,345,340,344,341,343,342,331,332,333,329,330,334,387,474,476,475,507,516,505,506,517,512,513,511,515,509,508,514,510,290,493,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,286,182,287,288,183,184,185,282,280,186,281,155,156,157,158,159,168,169,170,172,173,171,160,162,163,161,164,165,166,167,174,284,176,175,283,228,267,269,270,278,271,272,273,274,276,275,277,268,279,252,206,207,230,231,232,233,234,235,253,254,256,265,258,257,259,260,264,261,262,263,229,266,255,250,237,246,238,239,248,240,241,249,247,242,245,243,244,251,236,285,296,295,293,297,301,305,291,306,308,309,310,313,318,317,311,319,320,322,321,385,431,375,314,383,323,382,434,435,381,312,327,443,433,386,442,380,325,326,384,388,389,430,292,294,316,315],"latestChangedDtsFile":"./types/node.d.ts"},"version":"4.8.4"} +\ No newline at end of file +diff --git a/dist/types/structs.d.ts b/dist/types/structs.d.ts +index 48ebab12dbfe4f157a857f7628a876eeace8024b..32dbbfe6b09aa1ed4a6920c8d5696b25423ca736 100644 +--- a/dist/types/structs.d.ts ++++ b/dist/types/structs.d.ts +@@ -1,6 +1,6 @@ + import type { Failure } from 'superstruct'; + import { Struct, StructError } from 'superstruct'; +-import type { AnyStruct } from 'superstruct/dist/utils'; ++import type { AnyStruct } from 'superstruct'; + /** + * Infer a struct type, only if it matches the specified type. This is useful + * for defining types and structs that are related to each other in separate diff --git a/jest.config.scripts.js b/jest.config.scripts.js index 7ab725ca7d..a143e614b9 100644 --- a/jest.config.scripts.js +++ b/jest.config.scripts.js @@ -42,7 +42,7 @@ module.exports = { // This ensures that Babel can resolve ESM exports correctly. moduleNameMapper: { '^@metamask/utils/(.+)$': [ - '/node_modules/@metamask/utils/dist/$1.js', + '/node_modules/@metamask/utils/dist/$1.cjs', ], }, diff --git a/package.json b/package.json index 5db3eb0709..6a617659e6 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,17 @@ "pre-push": "yarn lint" }, "resolutions": { + "@metamask/keyring-api@^6.0.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", + "@metamask/keyring-api@^6.1.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", + "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", + "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", + "@metamask/snaps-sdk@^4.2.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", + "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", + "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", + "@metamask/snaps-utils@^7.0.3": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", + "@metamask/snaps-utils@^7.3.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", + "@metamask/utils": "8.5.0", + "superstruct": "github:MetaMask/superstruct#v3.1.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/packages/assets-controllers/src/NftController.test.ts b/packages/assets-controllers/src/NftController.test.ts index 05e2961643..d39a7d3a4f 100644 --- a/packages/assets-controllers/src/NftController.test.ts +++ b/packages/assets-controllers/src/NftController.test.ts @@ -87,12 +87,6 @@ const SECOND_OWNER_ADDRESS = '0x500017171kasdfbou081'; const DEPRESSIONIST_CID_V1 = 'bafybeidf7aw7bmnmewwj4ayq3she2jfk5jrdpp24aaucf6fddzb3cfhrvm'; -const DEPRESSIONIST_CLOUDFLARE_IPFS_SUBDOMAIN_PATH = getFormattedIpfsUrl( - IPFS_DEFAULT_GATEWAY_URL, - `ipfs://${DEPRESSIONIST_CID_V1}`, - true, -); - const SEPOLIA = { chainId: toHex(11155111), type: NetworkType.sepolia, @@ -296,7 +290,7 @@ function setupController({ } describe('NftController', () => { - beforeEach(() => { + beforeEach(async () => { nock(NFT_API_BASE_URL) .get( `/tokens?chainIds=1&tokens=0x01%3A1&includeTopBid=true&includeAttributes=true&includeLastSale=true`, @@ -317,7 +311,11 @@ describe('NftController', () => { }, ], }); - + const DEPRESSIONIST_CLOUDFLARE_IPFS_SUBDOMAIN_PATH = await getFormattedIpfsUrl( + IPFS_DEFAULT_GATEWAY_URL, + `ipfs://${DEPRESSIONIST_CID_V1}`, + true, + ); nock(DEPRESSIONIST_CLOUDFLARE_IPFS_SUBDOMAIN_PATH).get('/').reply(200, { name: 'name', image: 'image', diff --git a/packages/assets-controllers/src/NftController.ts b/packages/assets-controllers/src/NftController.ts index 8b79b778d8..b8f2df4f54 100644 --- a/packages/assets-controllers/src/NftController.ts +++ b/packages/assets-controllers/src/NftController.ts @@ -638,7 +638,7 @@ export class NftController extends BaseController< } if (hasIpfsTokenURI) { - tokenURI = getFormattedIpfsUrl( + tokenURI = await getFormattedIpfsUrl( this.#ipfsGateway, tokenURI, this.#useIpfsSubdomains, diff --git a/packages/assets-controllers/src/TokenDetectionController.test.ts b/packages/assets-controllers/src/TokenDetectionController.test.ts index 2e23ceb5fd..58e1f9fd81 100644 --- a/packages/assets-controllers/src/TokenDetectionController.test.ts +++ b/packages/assets-controllers/src/TokenDetectionController.test.ts @@ -15,8 +15,7 @@ import type { NetworkClientId, } from '@metamask/network-controller'; import { defaultState as defaultNetworkState } from '@metamask/network-controller'; -import type { AutoManagedNetworkClient } from '@metamask/network-controller/src/create-auto-managed-network-client'; -import type { CustomNetworkClientConfiguration } from '@metamask/network-controller/src/types'; +import type { AutoManagedNetworkClient, CustomNetworkClientConfiguration } from '@metamask/network-controller'; import { getDefaultPreferencesState, type PreferencesState, diff --git a/packages/assets-controllers/src/assetsUtil.ts b/packages/assets-controllers/src/assetsUtil.ts index 0f06f0ab53..3f47f9b190 100644 --- a/packages/assets-controllers/src/assetsUtil.ts +++ b/packages/assets-controllers/src/assetsUtil.ts @@ -6,7 +6,6 @@ import { import type { Hex } from '@metamask/utils'; import { remove0x } from '@metamask/utils'; import BN from 'bn.js'; -import { CID } from 'multiformats'; import type { Nft, NftMetadata } from './NftController'; import type { AbstractTokenPricesService } from './token-prices-service'; @@ -217,10 +216,10 @@ export function removeIpfsProtocolPrefix(ipfsUrl: string) { * @returns IFPS content identifier (cid) and sub path as string. * @throws Will throw if the url passed is not ipfs. */ -export function getIpfsCIDv1AndPath(ipfsUrl: string): { +export async function getIpfsCIDv1AndPath(ipfsUrl: string): Promise<{ cid: string; path?: string; -} { +}> { const url = removeIpfsProtocolPrefix(ipfsUrl); // check if there is a path @@ -229,6 +228,7 @@ export function getIpfsCIDv1AndPath(ipfsUrl: string): { const cid = index !== -1 ? url.substring(0, index) : url; const path = index !== -1 ? url.substring(index) : undefined; + const { CID } = await import('multiformats/cid'); // We want to ensure that the CID is v1 (https://docs.ipfs.io/concepts/content-addressing/#identifier-formats) // because most cid v0s appear to be incompatible with IPFS subdomains return { @@ -245,14 +245,14 @@ export function getIpfsCIDv1AndPath(ipfsUrl: string): { * @param subdomainSupported - Boolean indicating whether the URL should be formatted with subdomains or not. * @returns A formatted URL, with the user's preferred IPFS gateway and format (subdomain or not), pointing to an asset hosted on IPFS. */ -export function getFormattedIpfsUrl( +export async function getFormattedIpfsUrl( ipfsGateway: string, ipfsUrl: string, subdomainSupported: boolean, -): string { +): Promise { const { host, protocol, origin } = new URL(addUrlProtocolPrefix(ipfsGateway)); if (subdomainSupported) { - const { cid, path } = getIpfsCIDv1AndPath(ipfsUrl); + const { cid, path } = await getIpfsCIDv1AndPath(ipfsUrl); return `${protocol}//${cid}.ipfs.${host}${path ?? ''}`; } const cidAndPath = removeIpfsProtocolPrefix(ipfsUrl); diff --git a/packages/network-controller/src/index.ts b/packages/network-controller/src/index.ts index 9a02ded2a6..240593dfb4 100644 --- a/packages/network-controller/src/index.ts +++ b/packages/network-controller/src/index.ts @@ -1,6 +1,7 @@ +export type { AutoManagedNetworkClient } from './create-auto-managed-network-client'; export * from './NetworkController'; export * from './constants'; export type { BlockTracker, Provider } from './types'; -export type { NetworkClientConfiguration } from './types'; +export type { NetworkClientConfiguration, InfuraNetworkClientConfiguration, CustomNetworkClientConfiguration } from './types'; export { NetworkClientType } from './types'; export type { NetworkClient } from './create-network-client'; diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index 7b3aca7c13..19cf18664c 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -51,12 +51,12 @@ "@metamask/network-controller": "^19.0.0", "@metamask/polling-controller": "^8.0.0", "@metamask/rpc-errors": "^6.2.1", + "@metamask/superstruct": "^3.1.0", "@metamask/transaction-controller": "^33.0.1", "@metamask/utils": "^8.3.0", "bn.js": "^5.2.1", "immer": "^9.0.6", "lodash": "^4.17.21", - "superstruct": "^1.0.3", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/packages/user-operation-controller/src/utils/validation.ts b/packages/user-operation-controller/src/utils/validation.ts index 60309a819b..88a8ac5dd1 100644 --- a/packages/user-operation-controller/src/utils/validation.ts +++ b/packages/user-operation-controller/src/utils/validation.ts @@ -1,6 +1,4 @@ -import { TransactionType } from '@metamask/transaction-controller'; -import { isStrictHexString } from '@metamask/utils'; -import type { Struct, StructError } from 'superstruct'; +import type { Struct, StructError } from '@metamask/superstruct'; import { assert, boolean, @@ -12,7 +10,9 @@ import { optional, refine, string, -} from 'superstruct'; +} from '@metamask/superstruct'; +import { TransactionType } from '@metamask/transaction-controller'; +import { isStrictHexString } from '@metamask/utils'; import { EMPTY_BYTES } from '../constants'; import type { diff --git a/yarn.lock b/yarn.lock index 2088d5986e..c2f3b12301 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,13 +5,6 @@ __metadata: version: 6 cacheKey: 8 -"@aashutoshrathi/word-wrap@npm:^1.2.3": - version: 1.2.6 - resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" - checksum: ada901b9e7c680d190f1d012c84217ce0063d8f5c5a7725bb91ec3c5ed99bb7572680eb2d2938a531ccbaec39a95422fcd8a6b4a13110c7d98dd75402f66a0cd - languageName: node - linkType: hard - "@adraffy/ens-normalize@npm:1.10.1": version: 1.10.1 resolution: "@adraffy/ens-normalize@npm:1.10.1" @@ -38,264 +31,269 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.24.1, @babel/code-frame@npm:^7.24.2": - version: 7.24.2 - resolution: "@babel/code-frame@npm:7.24.2" +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/code-frame@npm:7.24.7" dependencies: - "@babel/highlight": ^7.24.2 + "@babel/highlight": ^7.24.7 picocolors: ^1.0.0 - checksum: 70e867340cfe09ca5488b2f36372c45cabf43c79a5b6426e6df5ef0611ff5dfa75a57dda841895693de6008f32c21a7c97027a8c7bcabd63a7d17416cbead6f8 + checksum: 830e62cd38775fdf84d612544251ce773d544a8e63df667728cc9e0126eeef14c6ebda79be0f0bc307e8318316b7f58c27ce86702e0a1f5c321d842eb38ffda4 languageName: node linkType: hard -"@babel/compat-data@npm:^7.23.5": - version: 7.24.4 - resolution: "@babel/compat-data@npm:7.24.4" - checksum: 52ce371658dc7796c9447c9cb3b9c0659370d141b76997f21c5e0028cca4d026ca546b84bc8d157ce7ca30bd353d89f9238504eb8b7aefa9b1f178b4c100c2d4 +"@babel/compat-data@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/compat-data@npm:7.24.7" + checksum: 1fc276825dd434fe044877367dfac84171328e75a8483a6976aa28bf833b32367e90ee6df25bdd97c287d1aa8019757adcccac9153de70b1932c0d243a978ae9 languageName: node linkType: hard "@babel/core@npm:^7.1.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.23.2, @babel/core@npm:^7.23.5, @babel/core@npm:^7.7.2, @babel/core@npm:^7.8.0": - version: 7.24.4 - resolution: "@babel/core@npm:7.24.4" + version: 7.24.7 + resolution: "@babel/core@npm:7.24.7" dependencies: "@ampproject/remapping": ^2.2.0 - "@babel/code-frame": ^7.24.2 - "@babel/generator": ^7.24.4 - "@babel/helper-compilation-targets": ^7.23.6 - "@babel/helper-module-transforms": ^7.23.3 - "@babel/helpers": ^7.24.4 - "@babel/parser": ^7.24.4 - "@babel/template": ^7.24.0 - "@babel/traverse": ^7.24.1 - "@babel/types": ^7.24.0 + "@babel/code-frame": ^7.24.7 + "@babel/generator": ^7.24.7 + "@babel/helper-compilation-targets": ^7.24.7 + "@babel/helper-module-transforms": ^7.24.7 + "@babel/helpers": ^7.24.7 + "@babel/parser": ^7.24.7 + "@babel/template": ^7.24.7 + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 convert-source-map: ^2.0.0 debug: ^4.1.0 gensync: ^1.0.0-beta.2 json5: ^2.2.3 semver: ^6.3.1 - checksum: 15ecad7581f3329995956ba461961b1af7bed48901f14fe962ccd3217edca60049e9e6ad4ce48134618397e6c90230168c842e2c28e47ef1f16c97dbbf663c61 + checksum: 017497e2a1b4683a885219eef7d2aee83c1c0cf353506b2e180b73540ec28841d8ef1ea1837fa69f8c561574b24ddd72f04764b27b87afedfe0a07299ccef24d languageName: node linkType: hard -"@babel/generator@npm:^7.24.1, @babel/generator@npm:^7.24.4, @babel/generator@npm:^7.7.2": - version: 7.24.4 - resolution: "@babel/generator@npm:7.24.4" +"@babel/generator@npm:^7.24.7, @babel/generator@npm:^7.7.2": + version: 7.24.7 + resolution: "@babel/generator@npm:7.24.7" dependencies: - "@babel/types": ^7.24.0 + "@babel/types": ^7.24.7 "@jridgewell/gen-mapping": ^0.3.5 "@jridgewell/trace-mapping": ^0.3.25 jsesc: ^2.5.1 - checksum: 1b6146c31386c9df3eb594a2c36b5c98da4f67f7c06edb3d68a442b92516b21bb5ba3ad7dbe0058fe76625ed24d66923e15c95b0df75ef1907d4068921a699b8 + checksum: 0ff31a73b15429f1287e4d57b439bba4a266f8c673bb445fe313b82f6d110f586776997eb723a777cd7adad9d340edd162aea4973a90112c5d0cfcaf6686844b languageName: node linkType: hard -"@babel/helper-annotate-as-pure@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" +"@babel/helper-annotate-as-pure@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-annotate-as-pure@npm:7.24.7" dependencies: - "@babel/types": ^7.22.5 - checksum: 53da330f1835c46f26b7bf4da31f7a496dee9fd8696cca12366b94ba19d97421ce519a74a837f687749318f94d1a37f8d1abcbf35e8ed22c32d16373b2f6198d + "@babel/types": ^7.24.7 + checksum: 6178566099a6a0657db7a7fa601a54fb4731ca0b8614fbdccfd8e523c210c13963649bc8fdfd53ce7dd14d05e3dda2fb22dea5b30113c488b9eb1a906d60212e languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.23.6": - version: 7.23.6 - resolution: "@babel/helper-compilation-targets@npm:7.23.6" +"@babel/helper-compilation-targets@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-compilation-targets@npm:7.24.7" dependencies: - "@babel/compat-data": ^7.23.5 - "@babel/helper-validator-option": ^7.23.5 + "@babel/compat-data": ^7.24.7 + "@babel/helper-validator-option": ^7.24.7 browserslist: ^4.22.2 lru-cache: ^5.1.1 semver: ^6.3.1 - checksum: c630b98d4527ac8fe2c58d9a06e785dfb2b73ec71b7c4f2ddf90f814b5f75b547f3c015f110a010fd31f76e3864daaf09f3adcd2f6acdbfb18a8de3a48717590 + checksum: dfc88bc35e223ade796c7267901728217c665adc5bc2e158f7b0ae850de14f1b7941bec4fe5950ae46236023cfbdeddd9c747c276acf9b39ca31f8dd97dc6cc6 languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/helper-create-class-features-plugin@npm:7.24.4" +"@babel/helper-create-class-features-plugin@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-create-class-features-plugin@npm:7.24.7" dependencies: - "@babel/helper-annotate-as-pure": ^7.22.5 - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-function-name": ^7.23.0 - "@babel/helper-member-expression-to-functions": ^7.23.0 - "@babel/helper-optimise-call-expression": ^7.22.5 - "@babel/helper-replace-supers": ^7.24.1 - "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 - "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-environment-visitor": ^7.24.7 + "@babel/helper-function-name": ^7.24.7 + "@babel/helper-member-expression-to-functions": ^7.24.7 + "@babel/helper-optimise-call-expression": ^7.24.7 + "@babel/helper-replace-supers": ^7.24.7 + "@babel/helper-skip-transparent-expression-wrappers": ^7.24.7 + "@babel/helper-split-export-declaration": ^7.24.7 semver: ^6.3.1 peerDependencies: "@babel/core": ^7.0.0 - checksum: 75b0a51ae1f7232932559779b78711c271404d02d069156d1bd9a7982c165c5134058d2ec2d8b5f2e42026ee4f52ba2a30c86a7aa3bce6b5fd0991eb721abc8c + checksum: 371a181a1717a9b0cebc97727c8ea9ca6afa34029476a684b6030f9d1ad94dcdafd7de175da10b63ae3ba79e4e82404db8ed968ebf264b768f097e5d64faab71 languageName: node linkType: hard -"@babel/helper-environment-visitor@npm:^7.22.20": - version: 7.22.20 - resolution: "@babel/helper-environment-visitor@npm:7.22.20" - checksum: d80ee98ff66f41e233f36ca1921774c37e88a803b2f7dca3db7c057a5fea0473804db9fb6729e5dbfd07f4bed722d60f7852035c2c739382e84c335661590b69 +"@babel/helper-environment-visitor@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-environment-visitor@npm:7.24.7" + dependencies: + "@babel/types": ^7.24.7 + checksum: 079d86e65701b29ebc10baf6ed548d17c19b808a07aa6885cc141b690a78581b180ee92b580d755361dc3b16adf975b2d2058b8ce6c86675fcaf43cf22f2f7c6 languageName: node linkType: hard -"@babel/helper-function-name@npm:^7.23.0": - version: 7.23.0 - resolution: "@babel/helper-function-name@npm:7.23.0" +"@babel/helper-function-name@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-function-name@npm:7.24.7" dependencies: - "@babel/template": ^7.22.15 - "@babel/types": ^7.23.0 - checksum: e44542257b2d4634a1f979244eb2a4ad8e6d75eb6761b4cfceb56b562f7db150d134bc538c8e6adca3783e3bc31be949071527aa8e3aab7867d1ad2d84a26e10 + "@babel/template": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 142ee08922074dfdc0ff358e09ef9f07adf3671ab6eef4fca74dcf7a551f1a43717e7efa358c9e28d7eea84c28d7f177b7a58c70452fc312ae3b1893c5dab2a4 languageName: node linkType: hard -"@babel/helper-hoist-variables@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-hoist-variables@npm:7.22.5" +"@babel/helper-hoist-variables@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-hoist-variables@npm:7.24.7" dependencies: - "@babel/types": ^7.22.5 - checksum: 394ca191b4ac908a76e7c50ab52102669efe3a1c277033e49467913c7ed6f7c64d7eacbeabf3bed39ea1f41731e22993f763b1edce0f74ff8563fd1f380d92cc + "@babel/types": ^7.24.7 + checksum: 6cfdcf2289cd12185dcdbdf2435fa8d3447b797ac75851166de9fc8503e2fd0021db6baf8dfbecad3753e582c08e6a3f805c8d00cbed756060a877d705bd8d8d languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.23.0": - version: 7.23.0 - resolution: "@babel/helper-member-expression-to-functions@npm:7.23.0" +"@babel/helper-member-expression-to-functions@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-member-expression-to-functions@npm:7.24.7" dependencies: - "@babel/types": ^7.23.0 - checksum: 494659361370c979ada711ca685e2efe9460683c36db1b283b446122596602c901e291e09f2f980ecedfe6e0f2bd5386cb59768285446530df10c14df1024e75 + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 9fecf412f85fa23b7cf55d19eb69de39f8240426a028b141c9df2aed8cfedf20b3ec3318d40312eb7a3dec9eea792828ce0d590e0ff62da3da532482f537192c languageName: node linkType: hard -"@babel/helper-module-imports@npm:^7.22.15": - version: 7.24.3 - resolution: "@babel/helper-module-imports@npm:7.24.3" +"@babel/helper-module-imports@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-module-imports@npm:7.24.7" dependencies: - "@babel/types": ^7.24.0 - checksum: c23492189ba97a1ec7d37012336a5661174e8b88194836b6bbf90d13c3b72c1db4626263c654454986f924c6da8be7ba7f9447876d709cd00bd6ffde6ec00796 + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 8ac15d96d262b8940bc469052a048e06430bba1296369be695fabdf6799f201dd0b00151762b56012a218464e706bc033f27c07f6cec20c6f8f5fd6543c67054 languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.23.3": - version: 7.23.3 - resolution: "@babel/helper-module-transforms@npm:7.23.3" +"@babel/helper-module-transforms@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-module-transforms@npm:7.24.7" dependencies: - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-module-imports": ^7.22.15 - "@babel/helper-simple-access": ^7.22.5 - "@babel/helper-split-export-declaration": ^7.22.6 - "@babel/helper-validator-identifier": ^7.22.20 + "@babel/helper-environment-visitor": ^7.24.7 + "@babel/helper-module-imports": ^7.24.7 + "@babel/helper-simple-access": ^7.24.7 + "@babel/helper-split-export-declaration": ^7.24.7 + "@babel/helper-validator-identifier": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0 - checksum: 5d0895cfba0e16ae16f3aa92fee108517023ad89a855289c4eb1d46f7aef4519adf8e6f971e1d55ac20c5461610e17213f1144097a8f932e768a9132e2278d71 + checksum: ddff3b41c2667876b4e4e73d961168f48a5ec9560c95c8c2d109e6221f9ca36c6f90c6317eb7a47f2a3c99419c356e529a86b79174cad0d4f7a61960866b88ca languageName: node linkType: hard -"@babel/helper-optimise-call-expression@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-optimise-call-expression@npm:7.22.5" +"@babel/helper-optimise-call-expression@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-optimise-call-expression@npm:7.24.7" dependencies: - "@babel/types": ^7.22.5 - checksum: c70ef6cc6b6ed32eeeec4482127e8be5451d0e5282d5495d5d569d39eb04d7f1d66ec99b327f45d1d5842a9ad8c22d48567e93fc502003a47de78d122e355f7c + "@babel/types": ^7.24.7 + checksum: 280654eaf90e92bf383d7eed49019573fb35a98c9e992668f701ad099957246721044be2068cf6840cb2299e0ad393705a1981c88c23a1048096a8d59e5f79a3 languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.24.0, @babel/helper-plugin-utils@npm:^7.8.0": - version: 7.24.0 - resolution: "@babel/helper-plugin-utils@npm:7.24.0" - checksum: e2baa0eede34d2fa2265947042aa84d444aa48dc51e9feedea55b67fc1bc3ab051387e18b33ca7748285a6061390831ab82f8a2c767d08470b93500ec727e9b9 +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.24.7, @babel/helper-plugin-utils@npm:^7.8.0": + version: 7.24.7 + resolution: "@babel/helper-plugin-utils@npm:7.24.7" + checksum: 81f2a15751d892e4a8fce25390f973363a5b27596167861d2d6eab0f61856eb2ba389b031a9f19f669c0bd4dd601185828d3cebafd25431be7a1696f2ce3ef68 languageName: node linkType: hard -"@babel/helper-replace-supers@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/helper-replace-supers@npm:7.24.1" +"@babel/helper-replace-supers@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-replace-supers@npm:7.24.7" dependencies: - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-member-expression-to-functions": ^7.23.0 - "@babel/helper-optimise-call-expression": ^7.22.5 + "@babel/helper-environment-visitor": ^7.24.7 + "@babel/helper-member-expression-to-functions": ^7.24.7 + "@babel/helper-optimise-call-expression": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0 - checksum: c04182c34a3195c6396de2f2945f86cb60daa94ca7392db09bd8b0d4e7a15b02fbe1947c70f6062c87eadaea6d7135207129efa35cf458ea0987bab8c0f02d5a + checksum: 2bf0d113355c60d86a04e930812d36f5691f26c82d4ec1739e5ec0a4c982c9113dad3167f7c74f888a96328bd5e696372232406d8200e5979e6e0dc2af5e7c76 languageName: node linkType: hard -"@babel/helper-simple-access@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-simple-access@npm:7.22.5" +"@babel/helper-simple-access@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-simple-access@npm:7.24.7" dependencies: - "@babel/types": ^7.22.5 - checksum: fe9686714caf7d70aedb46c3cce090f8b915b206e09225f1e4dbc416786c2fdbbee40b38b23c268b7ccef749dd2db35f255338fb4f2444429874d900dede5ad2 + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: ddbf55f9dea1900213f2a1a8500fabfd21c5a20f44dcfa957e4b0d8638c730f88751c77f678644f754f1a1dc73f4eb8b766c300deb45a9daad000e4247957819 languageName: node linkType: hard -"@babel/helper-skip-transparent-expression-wrappers@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.22.5" +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.24.7" dependencies: - "@babel/types": ^7.22.5 - checksum: 1012ef2295eb12dc073f2b9edf3425661e9b8432a3387e62a8bc27c42963f1f216ab3124228015c748770b2257b4f1fda882ca8fa34c0bf485e929ae5bc45244 + "@babel/traverse": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 11b28fe534ce2b1a67c4d8e51a7b5711a2a0a0cae802f74614eee54cca58c744d9a62f6f60103c41759e81c537d270bfd665bf368a6bea214c6052f2094f8407 languageName: node linkType: hard -"@babel/helper-split-export-declaration@npm:^7.22.6": - version: 7.22.6 - resolution: "@babel/helper-split-export-declaration@npm:7.22.6" +"@babel/helper-split-export-declaration@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-split-export-declaration@npm:7.24.7" dependencies: - "@babel/types": ^7.22.5 - checksum: e141cace583b19d9195f9c2b8e17a3ae913b7ee9b8120246d0f9ca349ca6f03cb2c001fd5ec57488c544347c0bb584afec66c936511e447fd20a360e591ac921 + "@babel/types": ^7.24.7 + checksum: e3ddc91273e5da67c6953f4aa34154d005a00791dc7afa6f41894e768748540f6ebcac5d16e72541aea0c89bee4b89b4da6a3d65972a0ea8bfd2352eda5b7e22 languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.23.4": - version: 7.24.1 - resolution: "@babel/helper-string-parser@npm:7.24.1" - checksum: 8404e865b06013979a12406aab4c0e8d2e377199deec09dfe9f57b833b0c9ce7b6e8c1c553f2da8d0bcd240c5005bd7a269f4fef0d628aeb7d5fe035c436fb67 +"@babel/helper-string-parser@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-string-parser@npm:7.24.7" + checksum: 09568193044a578743dd44bf7397940c27ea693f9812d24acb700890636b376847a611cdd0393a928544e79d7ad5b8b916bd8e6e772bc8a10c48a647a96e7b1a languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.22.20": - version: 7.22.20 - resolution: "@babel/helper-validator-identifier@npm:7.22.20" - checksum: 136412784d9428266bcdd4d91c32bcf9ff0e8d25534a9d94b044f77fe76bc50f941a90319b05aafd1ec04f7d127cd57a179a3716009ff7f3412ef835ada95bdc +"@babel/helper-validator-identifier@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-validator-identifier@npm:7.24.7" + checksum: 6799ab117cefc0ecd35cd0b40ead320c621a298ecac88686a14cffceaac89d80cdb3c178f969861bf5fa5e4f766648f9161ea0752ecfe080d8e89e3147270257 languageName: node linkType: hard -"@babel/helper-validator-option@npm:^7.23.5": - version: 7.23.5 - resolution: "@babel/helper-validator-option@npm:7.23.5" - checksum: 537cde2330a8aede223552510e8a13e9c1c8798afee3757995a7d4acae564124fe2bf7e7c3d90d62d3657434a74340a274b3b3b1c6f17e9a2be1f48af29cb09e +"@babel/helper-validator-option@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-validator-option@npm:7.24.7" + checksum: 9689166bf3f777dd424c026841c8cd651e41b21242dbfd4569a53086179a3e744c8eddd56e9d10b54142270141c91581b53af0d7c00c82d552d2540e2a919f7e languageName: node linkType: hard -"@babel/helpers@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/helpers@npm:7.24.4" +"@babel/helpers@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helpers@npm:7.24.7" dependencies: - "@babel/template": ^7.24.0 - "@babel/traverse": ^7.24.1 - "@babel/types": ^7.24.0 - checksum: ecd2dc0b3b32e24b97fa3bcda432dd3235b77c2be1e16eafc35b8ef8f6c461faa99796a8bc2431a408c98b4aabfd572c160e2b67ecea4c5c9dd3a8314a97994a + "@babel/template": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: 934da58098a3670ca7f9f42425b9c44d0ca4f8fad815c0f51d89fc7b64c5e0b4c7d5fec038599de691229ada737edeaf72fad3eba8e16dd5842e8ea447f76b66 languageName: node linkType: hard -"@babel/highlight@npm:^7.10.4, @babel/highlight@npm:^7.24.2": - version: 7.24.2 - resolution: "@babel/highlight@npm:7.24.2" +"@babel/highlight@npm:^7.10.4, @babel/highlight@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/highlight@npm:7.24.7" dependencies: - "@babel/helper-validator-identifier": ^7.22.20 + "@babel/helper-validator-identifier": ^7.24.7 chalk: ^2.4.2 js-tokens: ^4.0.0 picocolors: ^1.0.0 - checksum: 5f17b131cc3ebf3ab285a62cf98a404aef1bd71a6be045e748f8d5bf66d6a6e1aefd62f5972c84369472e8d9f22a614c58a89cd331eb60b7ba965b31b1bbeaf5 + checksum: 5cd3a89f143671c4ac129960024ba678b669e6fc673ce078030f5175002d1d3d52bc10b22c5b916a6faf644b5028e9a4bd2bb264d053d9b05b6a98690f1d46f1 languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.24.0, @babel/parser@npm:^7.24.1, @babel/parser@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/parser@npm:7.24.4" +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/parser@npm:7.24.7" bin: parser: ./bin/babel-parser.js - checksum: 94c9e3e592894cd6fc57c519f4e06b65463df9be5f01739bb0d0bfce7ffcf99b3c2fdadd44dc59cc858ba2739ce6e469813a941c2f2dfacf333a3b2c9c5c8465 + checksum: fc9d2c4c8712f89672edc55c0dc5cf640dcec715b56480f111f85c2bc1d507e251596e4110d65796690a96ac37a4b60432af90b3e97bb47e69d4ef83872dbbd6 languageName: node linkType: hard @@ -354,14 +352,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-jsx@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-syntax-jsx@npm:7.24.1" +"@babel/plugin-syntax-jsx@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-syntax-jsx@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": ^7.24.0 + "@babel/helper-plugin-utils": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 712f7e7918cb679f106769f57cfab0bc99b311032665c428b98f4c3e2e6d567601d45386a4f246df6a80d741e1f94192b3f008800d66c4f1daae3ad825c243f0 + checksum: 7a5ca629d8ca1e1ee78705a78e58c12920d07ed8006d7e7232b31296a384ff5e41d7b649bde5561196041037bbb9f9715be1d1c20975df87ca204f34ad15b965 languageName: node linkType: hard @@ -442,105 +440,105 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-typescript@npm:^7.24.1, @babel/plugin-syntax-typescript@npm:^7.7.2": - version: 7.24.1 - resolution: "@babel/plugin-syntax-typescript@npm:7.24.1" +"@babel/plugin-syntax-typescript@npm:^7.24.7, @babel/plugin-syntax-typescript@npm:^7.7.2": + version: 7.24.7 + resolution: "@babel/plugin-syntax-typescript@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": ^7.24.0 + "@babel/helper-plugin-utils": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: bf4bd70788d5456b5f75572e47a2e31435c7c4e43609bd4dffd2cc0c7a6cf90aabcf6cd389e351854de9a64412a07d30effef5373251fe8f6a4c9db0c0163bda + checksum: 56fe84f3044ecbf038977281648db6b63bd1301f2fff6595820dc10ee276c1d1586919d48d52a8d497ecae32c958be38f42c1c8d174dc58aad856c516dc5b35a languageName: node linkType: hard -"@babel/plugin-transform-modules-commonjs@npm:^7.23.3, @babel/plugin-transform-modules-commonjs@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.1" +"@babel/plugin-transform-modules-commonjs@npm:^7.23.3, @babel/plugin-transform-modules-commonjs@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.7" dependencies: - "@babel/helper-module-transforms": ^7.23.3 - "@babel/helper-plugin-utils": ^7.24.0 - "@babel/helper-simple-access": ^7.22.5 + "@babel/helper-module-transforms": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-simple-access": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 11402b34c49f76aa921b43c2d76f3f129a32544a1dc4f0d1e48b310f9036ab75269a6d8684ed0198b7a0b07bd7898b12f0cacceb26fbb167999fd2a819aa0802 + checksum: bfda2a0297197ed342e2a02e5f9847a489a3ae40a4a7d7f00f4aeb8544a85e9006e0c5271c8f61f39bc97975ef2717b5594cf9486694377a53433162909d64c1 languageName: node linkType: hard -"@babel/plugin-transform-typescript@npm:^7.24.1": - version: 7.24.4 - resolution: "@babel/plugin-transform-typescript@npm:7.24.4" +"@babel/plugin-transform-typescript@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/plugin-transform-typescript@npm:7.24.7" dependencies: - "@babel/helper-annotate-as-pure": ^7.22.5 - "@babel/helper-create-class-features-plugin": ^7.24.4 - "@babel/helper-plugin-utils": ^7.24.0 - "@babel/plugin-syntax-typescript": ^7.24.1 + "@babel/helper-annotate-as-pure": ^7.24.7 + "@babel/helper-create-class-features-plugin": ^7.24.7 + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/plugin-syntax-typescript": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 57a9a776b1910c706d28972e4b056ced3af8fc59c29b2a6205c2bb2a408141ddb59a8f2f6041f8467a7b260942818767f4ecabb9f63adf7fddf2afa25e774dfc + checksum: 6b367d1e3d6bdbe438878a76436fc6903e2b4fd7c31fa036d43865570d282679ec3f7c0306399851f2866a9b36686a0ea8c343df3750f70d427f1fe20ca54310 languageName: node linkType: hard "@babel/preset-typescript@npm:^7.23.3": - version: 7.24.1 - resolution: "@babel/preset-typescript@npm:7.24.1" - dependencies: - "@babel/helper-plugin-utils": ^7.24.0 - "@babel/helper-validator-option": ^7.23.5 - "@babel/plugin-syntax-jsx": ^7.24.1 - "@babel/plugin-transform-modules-commonjs": ^7.24.1 - "@babel/plugin-transform-typescript": ^7.24.1 + version: 7.24.7 + resolution: "@babel/preset-typescript@npm:7.24.7" + dependencies: + "@babel/helper-plugin-utils": ^7.24.7 + "@babel/helper-validator-option": ^7.24.7 + "@babel/plugin-syntax-jsx": ^7.24.7 + "@babel/plugin-transform-modules-commonjs": ^7.24.7 + "@babel/plugin-transform-typescript": ^7.24.7 peerDependencies: "@babel/core": ^7.0.0-0 - checksum: f3e0ff8c20dd5abc82614df2d7953f1549a98282b60809478f7dfb41c29be63720f2d1d7a51ef1f0d939b65e8666cb7d36e32bc4f8ac2b74c20664efd41e8bdd + checksum: 12929b24757f3bd6548103475f86478eda4c872bc7cefd920b29591eee8f4a4f350561d888e133d632d0c9402b8615fdcec9138e5127a6567dcb22f804ff207f languageName: node linkType: hard "@babel/runtime@npm:^7.23.9": - version: 7.24.4 - resolution: "@babel/runtime@npm:7.24.4" + version: 7.24.7 + resolution: "@babel/runtime@npm:7.24.7" dependencies: regenerator-runtime: ^0.14.0 - checksum: 2f27d4c0ffac7ae7999ac0385e1106f2a06992a8bdcbf3da06adcac7413863cd08c198c2e4e970041bbea849e17f02e1df18875539b6afba76c781b6b59a07c3 + checksum: d17f29eed6f848ac15cdf4202a910b741facfb0419a9d79e5c7fa37df6362fc3227f1cc2e248cc6db5e53ddffb4caa6686c488e6e80ce3d29c36a4e74c8734ea languageName: node linkType: hard -"@babel/template@npm:^7.22.15, @babel/template@npm:^7.24.0, @babel/template@npm:^7.3.3": - version: 7.24.0 - resolution: "@babel/template@npm:7.24.0" +"@babel/template@npm:^7.24.7, @babel/template@npm:^7.3.3": + version: 7.24.7 + resolution: "@babel/template@npm:7.24.7" dependencies: - "@babel/code-frame": ^7.23.5 - "@babel/parser": ^7.24.0 - "@babel/types": ^7.24.0 - checksum: f257b003c071a0cecdbfceca74185f18fe62c055469ab5c1d481aab12abeebed328e67e0a19fd978a2a8de97b28953fa4bc3da6d038a7345fdf37923b9fcdec8 + "@babel/code-frame": ^7.24.7 + "@babel/parser": ^7.24.7 + "@babel/types": ^7.24.7 + checksum: ea90792fae708ddf1632e54c25fe1a86643d8c0132311f81265d2bdbdd42f9f4fac65457056c1b6ca87f7aa0d6a795b549566774bba064bdcea2034ab3960ee9 languageName: node linkType: hard -"@babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.24.1, @babel/traverse@npm:^7.7.2": - version: 7.24.1 - resolution: "@babel/traverse@npm:7.24.1" +"@babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.24.7, @babel/traverse@npm:^7.7.2": + version: 7.24.7 + resolution: "@babel/traverse@npm:7.24.7" dependencies: - "@babel/code-frame": ^7.24.1 - "@babel/generator": ^7.24.1 - "@babel/helper-environment-visitor": ^7.22.20 - "@babel/helper-function-name": ^7.23.0 - "@babel/helper-hoist-variables": ^7.22.5 - "@babel/helper-split-export-declaration": ^7.22.6 - "@babel/parser": ^7.24.1 - "@babel/types": ^7.24.0 + "@babel/code-frame": ^7.24.7 + "@babel/generator": ^7.24.7 + "@babel/helper-environment-visitor": ^7.24.7 + "@babel/helper-function-name": ^7.24.7 + "@babel/helper-hoist-variables": ^7.24.7 + "@babel/helper-split-export-declaration": ^7.24.7 + "@babel/parser": ^7.24.7 + "@babel/types": ^7.24.7 debug: ^4.3.1 globals: ^11.1.0 - checksum: 92a5ca906abfba9df17666d2001ab23f18600035f706a687055a0e392a690ae48d6fec67c8bd4ef19ba18699a77a5b7f85727e36b83f7d110141608fe0c24fe9 + checksum: 7cd366afe9e7ee77e493779fdf24f67bf5595247289364f4689e29688572505eaeb886d7a8f20ebb9c29fc2de7d0895e4ff9e203e78e39ac67239724d45aa83b languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.24.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.8.3": - version: 7.24.0 - resolution: "@babel/types@npm:7.24.0" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.23.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.3.3, @babel/types@npm:^7.8.3": + version: 7.24.7 + resolution: "@babel/types@npm:7.24.7" dependencies: - "@babel/helper-string-parser": ^7.23.4 - "@babel/helper-validator-identifier": ^7.22.20 + "@babel/helper-string-parser": ^7.24.7 + "@babel/helper-validator-identifier": ^7.24.7 to-fast-properties: ^2.0.0 - checksum: 4b574a37d490f621470ff36a5afaac6deca5546edcb9b5e316d39acbb20998e9c2be42f3fc0bf2b55906fc49ff2a5a6a097e8f5a726ee3f708a0b0ca93aed807 + checksum: 3e4437fced97e02982972ce5bebd318c47d42c9be2152c0fd28c6f786cc74086cc0a8fb83b602b846e41df37f22c36254338eada1a47ef9d8a1ec92332ca3ea8 languageName: node linkType: hard @@ -551,30 +549,30 @@ __metadata: languageName: node linkType: hard -"@contentful/content-source-maps@npm:^0.5.0": - version: 0.5.0 - resolution: "@contentful/content-source-maps@npm:0.5.0" +"@contentful/content-source-maps@npm:^0.6.0": + version: 0.6.1 + resolution: "@contentful/content-source-maps@npm:0.6.1" dependencies: "@vercel/stega": ^0.1.2 json-pointer: ^0.6.2 - checksum: 5372b9cdbf4a9e4123e7d83a3c71d6b476be1021cd7fcd908d66a1a8332770054e6344ca2778073d6137d22eef86ff97a314ce0f110567819a5614d9d88a2e00 + checksum: 2a4508d9094a4674b010f2973faa6ccf8c54e7ac25b35824fb27ae1c8da188451a37597fceb985a6be95bdbba2d3854a5ae4f8aeea2b28ed64754175ac24871b languageName: node linkType: hard "@contentful/rich-text-html-renderer@npm:^16.5.2": - version: 16.5.2 - resolution: "@contentful/rich-text-html-renderer@npm:16.5.2" + version: 16.6.1 + resolution: "@contentful/rich-text-html-renderer@npm:16.6.1" dependencies: - "@contentful/rich-text-types": ^16.5.2 + "@contentful/rich-text-types": ^16.6.1 escape-html: ^1.0.3 - checksum: 5d9cdd21109f6eb400bc858a7254f442cfd25683c44d68c597058412e195629a0638d99880abb9672f76b4e171fcaa3bf8788fde7a029cb6343b37b09af37f5f + checksum: 47bc6a7e233f3dec46039b9fe5b94d756d7ca729b704120f9250c7914bcece18d3313ba44df6b7ab00ec8064584411979fed4f0fd2759930cd29fa19ce388362 languageName: node linkType: hard -"@contentful/rich-text-types@npm:^16.0.2, @contentful/rich-text-types@npm:^16.5.2": - version: 16.5.2 - resolution: "@contentful/rich-text-types@npm:16.5.2" - checksum: d09e330bd8f42dfabe5dbcf59ee3138ab59269f4db0386bd441d39895b5cffcb8c1d171dad77d8b02b59634c75310df73bbaffc7d6d344f636eb1d5c4bfa3c5e +"@contentful/rich-text-types@npm:^16.0.2, @contentful/rich-text-types@npm:^16.6.1": + version: 16.6.1 + resolution: "@contentful/rich-text-types@npm:16.6.1" + checksum: 6681b018abbe5d97b99eede50388c2212281526758c880da89c41e618062c3b9d004e0208201032ab2da46eb4e42a2336173e98b89e5926f04dd8070e484024b languageName: node linkType: hard @@ -587,10 +585,10 @@ __metadata: languageName: node linkType: hard -"@endo/env-options@npm:^1.1.3": - version: 1.1.3 - resolution: "@endo/env-options@npm:1.1.3" - checksum: a11ef59bdd2efa359a337f42369c91fa7246d73cc65f14898ea462796e62904d451ece1456f6d70619d815547b7c5a6b39fd7865ebc72ca891b266f7ce088b92 +"@endo/env-options@npm:^1.1.4": + version: 1.1.4 + resolution: "@endo/env-options@npm:1.1.4" + checksum: 9d2a32e6aa7105a617855fa33ddc1dc845be944c3e42518e7e147a9320d8b083196943957a6c63e3db60615076e86fed13c3c1c1a2799f586ef087454aa6a294 languageName: node linkType: hard @@ -778,9 +776,9 @@ __metadata: linkType: hard "@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": - version: 4.10.0 - resolution: "@eslint-community/regexpp@npm:4.10.0" - checksum: 2a6e345429ea8382aaaf3a61f865cae16ed44d31ca917910033c02dc00d505d939f10b81e079fa14d43b51499c640138e153b7e40743c4c094d9df97d4e56f7b + version: 4.10.1 + resolution: "@eslint-community/regexpp@npm:4.10.1" + checksum: 1e04bc366fb8152c9266258cd25e3fded102f1d212a9476928e3cb98c48be645df6d676728d1c596053992fb9134879fe0de23c9460035b342cceb22d3af1776 languageName: node linkType: hard @@ -2095,9 +2093,9 @@ __metadata: linkType: hard "@json-rpc-specification/meta-schema@npm:^1.0.6": - version: 1.0.6 - resolution: "@json-rpc-specification/meta-schema@npm:1.0.6" - checksum: 2eb9c6c6c73bb38350c7180d1ad3c5b8462406926cae753741895b457d7b1b9f0b74148daf3462bb167cef39efdd1d9090308edf4d4938956863acb643c146eb + version: 1.0.7 + resolution: "@json-rpc-specification/meta-schema@npm:1.0.7" + checksum: 402cdc11f645fbcac7d62c8446af677ab014271131e304368bfa93c28eb92ca3f744d2d8b036b4a3008641a452f63367ef7722a9b2fc612ad4e89cb881ec8cb5 languageName: node linkType: hard @@ -2186,12 +2184,12 @@ __metadata: linkType: hard "@metamask/abi-utils@npm:^2.0.2": - version: 2.0.2 - resolution: "@metamask/abi-utils@npm:2.0.2" + version: 2.0.3 + resolution: "@metamask/abi-utils@npm:2.0.3" dependencies: - "@metamask/utils": ^8.0.0 - superstruct: ^1.0.3 - checksum: 5ec153e7691a4e1dc8738a0ba1a99a354ddb13851fa88a40a19f002f6308310e71c2cee28c3a25d9f7f67e839c7dffe4760e93e308dd17fa725b08d0dc73a3d4 + "@metamask/superstruct": ^3.0.0 + "@metamask/utils": ^8.5.0 + checksum: c0d43cd52a6615b32b09ed6786d01e3de764af30b107941a5df134f8a48da344793035dd247f5b38a56f36c436c7131b94b0c71ef004e88e6e00f878ffa4ebbf languageName: node linkType: hard @@ -2692,7 +2690,7 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-block-tracker@npm:^9.0.2, @metamask/eth-block-tracker@npm:^9.0.3": +"@metamask/eth-block-tracker@npm:^9.0.3": version: 9.0.3 resolution: "@metamask/eth-block-tracker@npm:9.0.3" dependencies: @@ -2732,19 +2730,19 @@ __metadata: linkType: hard "@metamask/eth-json-rpc-middleware@npm:^12.1.1": - version: 12.1.1 - resolution: "@metamask/eth-json-rpc-middleware@npm:12.1.1" + version: 12.1.2 + resolution: "@metamask/eth-json-rpc-middleware@npm:12.1.2" dependencies: - "@metamask/eth-block-tracker": ^9.0.2 - "@metamask/eth-json-rpc-provider": ^2.1.0 + "@metamask/eth-block-tracker": ^9.0.3 + "@metamask/eth-json-rpc-provider": ^3.0.2 "@metamask/eth-sig-util": ^7.0.0 - "@metamask/json-rpc-engine": ^7.1.1 + "@metamask/json-rpc-engine": ^8.0.2 "@metamask/rpc-errors": ^6.0.0 "@metamask/utils": ^8.1.0 klona: ^2.0.6 pify: ^5.0.0 safe-stable-stringify: ^2.4.3 - checksum: 097a316c94ad1b9e303b3d99cca198444b611fddfa0d37e12683d17a1f7ca9783250af41aa9d6451a0716b756678afe6cadaa6705556e362f9e0877b9d900499 + checksum: 0334fa8e51d73488e42e1cd663e90012f4055c5cd04cb4ff371ecb3552b82cd271f27a88ff0187ad23f195cfbbba467126711c08b20c1124083a706a85524a82 languageName: node linkType: hard @@ -2799,16 +2797,16 @@ __metadata: linkType: hard "@metamask/eth-sig-util@npm:^7.0.0, @metamask/eth-sig-util@npm:^7.0.1": - version: 7.0.1 - resolution: "@metamask/eth-sig-util@npm:7.0.1" + version: 7.0.2 + resolution: "@metamask/eth-sig-util@npm:7.0.2" dependencies: "@ethereumjs/util": ^8.1.0 "@metamask/abi-utils": ^2.0.2 "@metamask/utils": ^8.1.0 + "@scure/base": ~1.1.3 ethereum-cryptography: ^2.1.2 tweetnacl: ^1.0.3 - tweetnacl-util: ^0.15.1 - checksum: 98d056bd83aeb2d29ec3de09cd18e67d97ea295a59d405a9ce3fe274badd2d4f18da1fe530a266b4c777650855ed75ecd3577decd607a561e938dd7a808c5839 + checksum: f4aa8bf3dcfee0f99911e8e540cc3f6681e5d4b6d279ee2280062481492f45d57b0e4ce29165177b724ca75187dbb98471a679c6ba5f5244a14065596e45e255 languageName: node linkType: hard @@ -3015,19 +3013,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@npm:^7.0.1": - version: 7.0.2 - resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.2" - dependencies: - "@metamask/json-rpc-engine": ^8.0.2 - "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 - readable-stream: ^3.6.2 - checksum: ff11ad3ff0ec27530efc53c4e6543661648f437dacdd58797449307e20dbc428b479cd8d1e9767797268b98d0445bd6f1986820a8c855faeef01d5c03b55323b - languageName: node - linkType: hard - -"@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": +"@metamask/json-rpc-middleware-stream@^8.0.0, @metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": version: 0.0.0-use.local resolution: "@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream" dependencies: @@ -3050,7 +3036,19 @@ __metadata: languageName: unknown linkType: soft -"@metamask/key-tree@npm:^9.1.1": +"@metamask/json-rpc-middleware-stream@npm:^7.0.1": + version: 7.0.2 + resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.2" + dependencies: + "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^8.3.0 + readable-stream: ^3.6.2 + checksum: ff11ad3ff0ec27530efc53c4e6543661648f437dacdd58797449307e20dbc428b479cd8d1e9767797268b98d0445bd6f1986820a8c855faeef01d5c03b55323b + languageName: node + linkType: hard + +"@metamask/key-tree@npm:^9.1.0, @metamask/key-tree@npm:^9.1.1": version: 9.1.1 resolution: "@metamask/key-tree@npm:9.1.1" dependencies: @@ -3498,9 +3496,9 @@ __metadata: languageName: unknown linkType: soft -"@metamask/providers@npm:^17.0.0": - version: 17.0.0 - resolution: "@metamask/providers@npm:17.0.0" +"@metamask/providers@npm:^16.1.0": + version: 16.1.0 + resolution: "@metamask/providers@npm:16.1.0" dependencies: "@metamask/json-rpc-engine": ^8.0.1 "@metamask/json-rpc-middleware-stream": ^7.0.1 @@ -3513,9 +3511,29 @@ __metadata: fast-deep-equal: ^3.1.3 is-stream: ^2.0.0 readable-stream: ^3.6.2 + webextension-polyfill: ^0.10.0 + checksum: 85e40140f342a38112c3d7cee436751a2be4c575cc4f815ab48a73b549abc2d756bf4a10e4b983e91dbd38076601f992531edb6d8d674aebceae32ef7e299275 + languageName: node + linkType: hard + +"@metamask/providers@npm:^17.0.0": + version: 17.1.0 + resolution: "@metamask/providers@npm:17.1.0" + dependencies: + "@metamask/json-rpc-engine": ^9.0.0 + "@metamask/json-rpc-middleware-stream": ^8.0.0 + "@metamask/object-multiplex": ^2.0.0 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/safe-event-emitter": ^3.1.1 + "@metamask/utils": ^8.3.0 + detect-browser: ^5.2.0 + extension-port-stream: ^4.1.0 + fast-deep-equal: ^3.1.3 + is-stream: ^2.0.0 + readable-stream: ^3.6.2 peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 330e369458edc68d743d87b8b2597cdacac58df01b5fc31f565ae5dacee2390ee23693fb10fa451c6146665e87475a4c8f54163407eb05fceeb698900e34f9e6 + checksum: 1378f7e9a5385536e814190f880cd71bbb0a055b8a234012243ba9f54c5eace1d8bb5324732cb46b3046ad22349a698c1ca3c06402e52675b66e55b9b741f820 languageName: node linkType: hard @@ -3568,12 +3586,12 @@ __metadata: linkType: soft "@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.2.1": - version: 6.2.1 - resolution: "@metamask/rpc-errors@npm:6.2.1" + version: 6.3.0 + resolution: "@metamask/rpc-errors@npm:6.3.0" dependencies: "@metamask/utils": ^8.3.0 fast-safe-stringify: ^2.0.6 - checksum: a9223c3cb9ab05734ea0dda990597f90a7cdb143efa0c026b1a970f2094fe5fa3c341ed39b1e7623be13a96b98fb2c697ef51a2e2b87d8f048114841d35ee0a9 + checksum: de79d132f149cba6d2efcf7b17b93d0bad92c7e5c15b3826f889e0b01979883d71acc4445b781098cee13c3837c807ee56f8b03bce78887f6a6bc95de1adfe9d languageName: node linkType: hard @@ -3658,8 +3676,8 @@ __metadata: linkType: hard "@metamask/snaps-controllers@npm:^8.1.1": - version: 8.3.1 - resolution: "@metamask/snaps-controllers@npm:8.3.1" + version: 8.4.0 + resolution: "@metamask/snaps-controllers@npm:8.4.0" dependencies: "@metamask/approval-controller": ^6.0.2 "@metamask/base-controller": ^5.0.2 @@ -3672,8 +3690,8 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/snaps-registry": ^3.1.0 "@metamask/snaps-rpc-methods": ^9.1.2 - "@metamask/snaps-sdk": ^4.4.1 - "@metamask/snaps-utils": ^7.4.1 + "@metamask/snaps-sdk": ^4.4.2 + "@metamask/snaps-utils": ^7.5.0 "@metamask/utils": ^8.3.0 "@xstate/fsm": ^2.0.0 browserify-zlib: ^0.2.0 @@ -3690,41 +3708,55 @@ __metadata: peerDependenciesMeta: "@metamask/snaps-execution-environments": optional: true - checksum: d2fccfc9a4fdea68c89755a0e93e292eafdbe28515fcf1f5ba761d4fb057ae2f1732d242f776cd089ea8dfbd0f84d9d2151778ba529fd9b5b4c7b00460a612ab + checksum: a5aadae406cb3267492931a418740a1a2d6b5cc3966b5f9c788bf11ec96d97712bef1f168fbe0a8aa575481ba5ae0869c06aeffc9f1b72403189aeaf89b3ca1b languageName: node linkType: hard "@metamask/snaps-registry@npm:^3.1.0": - version: 3.1.0 - resolution: "@metamask/snaps-registry@npm:3.1.0" + version: 3.2.0 + resolution: "@metamask/snaps-registry@npm:3.2.0" dependencies: - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.0.0 + "@metamask/utils": ^8.5.0 "@noble/curves": ^1.2.0 "@noble/hashes": ^1.3.2 - superstruct: ^1.0.3 - checksum: 019cb47134c2ad4724f4f392385d4e81ab61dfefb12e66a88a2480a178502190e2d5d99cf269b906e4acda1b88de3fe356c80e71dc32c6c3f0fada9461c9bc49 + checksum: ac3537cda6454f461e6d00623aefa29ee3e7f7c68003c7629fc550c1f27694115c475d626c89172bd7ecb52de2a0b75db64aa9fe9e8625492e335337d3f579f7 languageName: node linkType: hard "@metamask/snaps-rpc-methods@npm:^9.1.2": - version: 9.1.2 - resolution: "@metamask/snaps-rpc-methods@npm:9.1.2" + version: 9.1.4 + resolution: "@metamask/snaps-rpc-methods@npm:9.1.4" dependencies: "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^9.0.2 + "@metamask/permission-controller": ^10.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/snaps-sdk": ^4.4.1 - "@metamask/snaps-utils": ^7.4.1 + "@metamask/snaps-sdk": ^6.0.0 + "@metamask/snaps-utils": ^7.7.0 "@metamask/utils": ^8.3.0 "@noble/hashes": ^1.3.1 superstruct: ^1.0.3 - checksum: dffe041f69ae8593c080155b9338ed86997fd0e23098ccadbc80a2a17a461d3744008b30b419a49be93dbc8482c2f01f6c9fcbf844f58cebdae2439b81353d4b + checksum: f32775c53afb83f6f6907e72bec412ba21a8535c50910d2e2fac7efa68bac7d62dd162ca0329297287b4f8f507f9fda2dcc4396966931ce8e9331d5fddbfc343 languageName: node linkType: hard -"@metamask/snaps-sdk@npm:^4.2.0, @metamask/snaps-sdk@npm:^4.4.1": - version: 4.4.1 - resolution: "@metamask/snaps-sdk@npm:4.4.1" +"@metamask/snaps-sdk@npm:4.2.0": + version: 4.2.0 + resolution: "@metamask/snaps-sdk@npm:4.2.0" + dependencies: + "@metamask/key-tree": ^9.1.0 + "@metamask/providers": ^16.1.0 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/utils": ^8.3.0 + fast-xml-parser: ^4.3.4 + superstruct: ^1.0.3 + checksum: f9b0e6d7600680183e69d419f5a802208fdc119c7d1226a74076f3b8b8c581850b135392c2f35c391305fc37406973afeb19d8909101580ec16b63fd2f200a8c + languageName: node + linkType: hard + +"@metamask/snaps-sdk@npm:^4.4.2": + version: 4.4.2 + resolution: "@metamask/snaps-sdk@npm:4.4.2" dependencies: "@metamask/key-tree": ^9.1.1 "@metamask/providers": ^17.0.0 @@ -3732,23 +3764,50 @@ __metadata: "@metamask/utils": ^8.3.0 fast-xml-parser: ^4.3.4 superstruct: ^1.0.3 - checksum: 29dfc36821e77d033ddc1b8f1b8924b4880aca41a25e1767741b50659990a79d3026f3975613090342e98d0cf8d876a0e003edb23ff39d2927dc6473d5c441f9 + checksum: 2ff3949cee3b6c5a580304a02191f3ec7fb049460c2ff89b1731f24b215baf5f9c08834a0b2b703ff43e3b74ede387386e22a96810b50be106bb029b180c44ce languageName: node linkType: hard -"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.4.1": - version: 7.4.1 - resolution: "@metamask/snaps-utils@npm:7.4.1" +"@metamask/snaps-sdk@npm:^6.0.0": + version: 6.0.0 + resolution: "@metamask/snaps-sdk@npm:6.0.0" + dependencies: + "@metamask/key-tree": ^9.1.1 + "@metamask/providers": ^17.0.0 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/utils": ^8.3.0 + superstruct: ^1.0.3 + checksum: 0a3b7a034028a7583b4e1a5414a67470b2ed70cc411fc4877a79f95803c64d99eafb785cbffaf827c3f3138a065e439480b9628456a8a5fa8d39c9c8dd9bd5db + languageName: node + linkType: hard + +"@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": + version: 4.2.0 + resolution: "@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch::version=4.2.0&hash=3dabd5&locator=%40metamask%2Fcore-monorepo%40workspace%3A." + dependencies: + "@metamask/key-tree": ^9.1.0 + "@metamask/providers": ^16.1.0 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/utils": ^8.3.0 + fast-xml-parser: ^4.3.4 + superstruct: ^1.0.3 + checksum: cf8e270fc47ca72736fa12f0e77b7f0a25536e7c003ead1720f8be914039e22c49e111104db1278c41b623451a0494fe6f7422bc7685c9689f1430c7976c240b + languageName: node + linkType: hard + +"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0": + version: 7.7.0 + resolution: "@metamask/snaps-utils@npm:7.7.0" dependencies: "@babel/core": ^7.23.2 "@babel/types": ^7.23.0 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^9.0.2 + "@metamask/permission-controller": ^10.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/slip44": ^3.1.0 "@metamask/snaps-registry": ^3.1.0 - "@metamask/snaps-sdk": ^4.4.1 + "@metamask/snaps-sdk": ^6.0.0 "@metamask/utils": ^8.3.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 @@ -3756,13 +3815,21 @@ __metadata: cron-parser: ^4.5.0 fast-deep-equal: ^3.1.3 fast-json-stable-stringify: ^2.1.0 + fast-xml-parser: ^4.3.4 marked: ^12.0.1 rfdc: ^1.3.0 semver: ^7.5.4 ses: ^1.1.0 superstruct: ^1.0.3 validate-npm-package-name: ^5.0.0 - checksum: d1d6d3c769c33df88fb6e4fc852cdfe1e400b25b1cae020e729f1bfe8a094804cf901700afbbf1372cc1e95f697127b5847bf3a85b46b403ba2ae64ee5750d22 + checksum: e801f4ce39c05e7d328e13968174f6d61dd388404218f8cafa43cccd0b54cfe46473d82e03ec1654a0db28a9a46238380bab45d67edf12d81392393246127c71 + languageName: node + linkType: hard + +"@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": + version: 3.1.0 + resolution: "@metamask/superstruct@npm:3.1.0" + checksum: 00e4d0c0aae8b25ccc1885c1db0bb4ed1590010570140c255e4deee3bf8a10c859c8fce5e475b4ae09c8a56316207af87585b91f7f5a5c028d668ccd111f19e3 languageName: node linkType: hard @@ -3840,6 +3907,7 @@ __metadata: "@metamask/network-controller": ^19.0.0 "@metamask/polling-controller": ^8.0.0 "@metamask/rpc-errors": ^6.2.1 + "@metamask/superstruct": ^3.1.0 "@metamask/transaction-controller": ^33.0.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -3848,7 +3916,6 @@ __metadata: immer: ^9.0.6 jest: ^27.5.1 lodash: ^4.17.21 - superstruct: ^1.0.3 ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 @@ -3863,26 +3930,26 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:^8.0.0, @metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0": - version: 8.4.0 - resolution: "@metamask/utils@npm:8.4.0" +"@metamask/utils@npm:8.5.0": + version: 8.5.0 + resolution: "@metamask/utils@npm:8.5.0" dependencies: "@ethereumjs/tx": ^4.2.0 + "@metamask/superstruct": ^3.0.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.3 "@types/debug": ^4.1.7 debug: ^4.3.4 pony-cause: ^2.1.10 semver: ^7.5.4 - superstruct: ^1.0.3 uuid: ^9.0.1 - checksum: b0397e97bac7192f6189a8625a2dfcb56d3c2cf4dd2cb3d4e012a7e9786f04f59f6917805544bc131a6dacd2c8344e237ae43ad47429bb5eb35c6cf1248440b4 + checksum: e8eac1c796c3f6b623be3c2736e8682248620f666b180f5c12ce56ee09587d4e28b6811862139a05c7a1bec91415f10ccf0516f3cdf342f88b0189d2a057c24b languageName: node linkType: hard "@ngraveio/bc-ur@npm:^1.1.5": - version: 1.1.12 - resolution: "@ngraveio/bc-ur@npm:1.1.12" + version: 1.1.13 + resolution: "@ngraveio/bc-ur@npm:1.1.13" dependencies: "@keystonehq/alias-sampling": ^0.1.1 assert: ^2.0.0 @@ -3891,14 +3958,14 @@ __metadata: crc: ^3.8.0 jsbi: ^3.1.5 sha.js: ^2.4.11 - checksum: ba23bec15fe0d84cdb8d8e5764dad4d06ced1a4787316fdd5f0a905aa0a4a5a68f3813e7731006c1d5dcca854d2d33ee768045e0c1f7529055998c516f7ac4c8 + checksum: 3f8e565c6a6dd7af7489a884f7d4d85d274ce7ce41f9fdb7e362b8a75ccbb2c934b369fd4ea58b2214d6039462ee0e933de61f372c04c551a47a75e1cad14cfd languageName: node linkType: hard "@noble/ciphers@npm:^0.5.2": - version: 0.5.2 - resolution: "@noble/ciphers@npm:0.5.2" - checksum: b3b32c8cb9ef4450358116edf97900d20465eaf76c3103cbb72851da0b6b5815cb2a65b24f5a1d1abd8658064cb29d75b17512dbe97bc546273a63fc3306a599 + version: 0.5.3 + resolution: "@noble/ciphers@npm:0.5.3" + checksum: c5ed5d7d43b054c2051b3e0e220353cc9d31fa8d17b82cfb753d87f922e4e1e69b73ca5273a9cc457023f83d96d1d9a51678d2f6d4e58ca039d1111a62856d19 languageName: node linkType: hard @@ -3911,16 +3978,7 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.3.0, @noble/curves@npm:~1.3.0": - version: 1.3.0 - resolution: "@noble/curves@npm:1.3.0" - dependencies: - "@noble/hashes": 1.3.3 - checksum: b65342ee66c4a440eee2978524412eabba9a9efdd16d6370e15218c6a7d80bddf35e66bb57ed52c0dfd32cb9a717b439ab3a72db618f1a0066dfebe3fd12a421 - languageName: node - linkType: hard - -"@noble/curves@npm:^1.2.0": +"@noble/curves@npm:1.4.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.4.0": version: 1.4.0 resolution: "@noble/curves@npm:1.4.0" dependencies: @@ -3936,20 +3994,20 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.3, @noble/hashes@npm:~1.3.2": - version: 1.3.3 - resolution: "@noble/hashes@npm:1.3.3" - checksum: 8a6496d1c0c64797339bc694ad06cdfaa0f9e56cd0c3f68ae3666cfb153a791a55deb0af9c653c7ed2db64d537aa3e3054629740d2f2338bb1dcb7ab60cd205b - languageName: node - linkType: hard - -"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:^1.4.0": +"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:~1.4.0": version: 1.4.0 resolution: "@noble/hashes@npm:1.4.0" checksum: 8ba816ae26c90764b8c42493eea383716396096c5f7ba6bea559993194f49d80a73c081f315f4c367e51bd2d5891700bcdfa816b421d24ab45b41cb03e4f3342 languageName: node linkType: hard +"@noble/hashes@npm:~1.3.2": + version: 1.3.3 + resolution: "@noble/hashes@npm:1.3.3" + checksum: 8a6496d1c0c64797339bc694ad06cdfaa0f9e56cd0c3f68ae3666cfb153a791a55deb0af9c653c7ed2db64d537aa3e3054629740d2f2338bb1dcb7ab60cd205b + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -3991,27 +4049,27 @@ __metadata: linkType: hard "@npmcli/fs@npm:^3.1.0": - version: 3.1.0 - resolution: "@npmcli/fs@npm:3.1.0" + version: 3.1.1 + resolution: "@npmcli/fs@npm:3.1.1" dependencies: semver: ^7.3.5 - checksum: a50a6818de5fc557d0b0e6f50ec780a7a02ab8ad07e5ac8b16bf519e0ad60a144ac64f97d05c443c3367235d337182e1d012bbac0eb8dbae8dc7b40b193efd0e + checksum: d960cab4b93adcb31ce223bfb75c5714edbd55747342efb67dcc2f25e023d930a7af6ece3e75f2f459b6f38fc14d031c766f116cd124fdc937fd33112579e820 languageName: node linkType: hard "@npmcli/git@npm:^5.0.0": - version: 5.0.5 - resolution: "@npmcli/git@npm:5.0.5" + version: 5.0.7 + resolution: "@npmcli/git@npm:5.0.7" dependencies: "@npmcli/promise-spawn": ^7.0.0 lru-cache: ^10.0.1 npm-pick-manifest: ^9.0.0 - proc-log: ^3.0.0 + proc-log: ^4.0.0 promise-inflight: ^1.0.1 promise-retry: ^2.0.1 semver: ^7.3.5 which: ^4.0.0 - checksum: d10a05669a7203f809d1961c638568eed226614eba5c24c55add9878f26b495c11994de0a34f5f2c5db189cc209c52d36374ed5b5f9be2ecd84788865bf2152a + checksum: a83d4e032ca71671615de532b2d62c6bcf6342819a4a25da650ac66f8b5803357e629ad9dacada307891d9428bc5e777cca0b8cbc3ee76b66bbddce3851c30f5 languageName: node linkType: hard @@ -4023,26 +4081,26 @@ __metadata: linkType: hard "@npmcli/package-json@npm:^5.0.0": - version: 5.0.2 - resolution: "@npmcli/package-json@npm:5.0.2" + version: 5.2.0 + resolution: "@npmcli/package-json@npm:5.2.0" dependencies: "@npmcli/git": ^5.0.0 glob: ^10.2.2 hosted-git-info: ^7.0.0 json-parse-even-better-errors: ^3.0.0 normalize-package-data: ^6.0.0 - proc-log: ^3.0.0 + proc-log: ^4.0.0 semver: ^7.5.3 - checksum: f0e69d093a5733c7d31ce45098e2ce059f01d09b79329a7f3e975baf91d87f4bf3171fadc27442f4f540dc546954259f178be40ca632b87cfe16bcfe04f00dd3 + checksum: 8df289c45b52cca88826cc737195cabf21757008e11d90b1f62d5400ff65834c0e9bcb552f235ba560c3af436a1ca3fc553b23b5cb5da8330ae56929065a6988 languageName: node linkType: hard "@npmcli/promise-spawn@npm:^7.0.0": - version: 7.0.1 - resolution: "@npmcli/promise-spawn@npm:7.0.1" + version: 7.0.2 + resolution: "@npmcli/promise-spawn@npm:7.0.2" dependencies: which: ^4.0.0 - checksum: a2b25d66d4dc835c69593bdf56588d66299fde3e80be4978347e686f24647007b794ce4da4cfcfcc569c67112720b746c4e7bf18ce45c096712d8b75fed19ec7 + checksum: 728256506ecbafb53064036e28c2815b9a9e9190ba7a48eec77b011a9f8a899515a6d96760dbde960bc1d3e5b828fd0b0b7fe3b512efaf049d299bacbd732fda languageName: node linkType: hard @@ -4146,143 +4204,143 @@ __metadata: languageName: node linkType: hard -"@rollup/rollup-android-arm-eabi@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-android-arm-eabi@npm:4.16.4" +"@rollup/rollup-android-arm-eabi@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.18.0" conditions: os=android & cpu=arm languageName: node linkType: hard -"@rollup/rollup-android-arm64@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-android-arm64@npm:4.16.4" +"@rollup/rollup-android-arm64@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-android-arm64@npm:4.18.0" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-arm64@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-darwin-arm64@npm:4.16.4" +"@rollup/rollup-darwin-arm64@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-darwin-arm64@npm:4.18.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-x64@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-darwin-x64@npm:4.16.4" +"@rollup/rollup-darwin-x64@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-darwin-x64@npm:4.18.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-linux-arm-gnueabihf@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.16.4" +"@rollup/rollup-linux-arm-gnueabihf@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.18.0" conditions: os=linux & cpu=arm & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm-musleabihf@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.16.4" +"@rollup/rollup-linux-arm-musleabihf@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.18.0" conditions: os=linux & cpu=arm & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-arm64-gnu@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.16.4" +"@rollup/rollup-linux-arm64-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.18.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm64-musl@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-arm64-musl@npm:4.16.4" +"@rollup/rollup-linux-arm64-musl@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.18.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-powerpc64le-gnu@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.16.4" +"@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.0" conditions: os=linux & cpu=ppc64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-riscv64-gnu@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.16.4" +"@rollup/rollup-linux-riscv64-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.18.0" conditions: os=linux & cpu=riscv64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-s390x-gnu@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.16.4" +"@rollup/rollup-linux-s390x-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.18.0" conditions: os=linux & cpu=s390x & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-gnu@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-x64-gnu@npm:4.16.4" +"@rollup/rollup-linux-x64-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.18.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-musl@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-linux-x64-musl@npm:4.16.4" +"@rollup/rollup-linux-x64-musl@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.18.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-win32-arm64-msvc@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.16.4" +"@rollup/rollup-win32-arm64-msvc@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.18.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-win32-ia32-msvc@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.16.4" +"@rollup/rollup-win32-ia32-msvc@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.18.0" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@rollup/rollup-win32-x64-msvc@npm:4.16.4": - version: 4.16.4 - resolution: "@rollup/rollup-win32-x64-msvc@npm:4.16.4" +"@rollup/rollup-win32-x64-msvc@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.18.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@scure/base@npm:^1.0.0, @scure/base@npm:^1.1.1, @scure/base@npm:^1.1.3, @scure/base@npm:~1.1.3, @scure/base@npm:~1.1.4": - version: 1.1.6 - resolution: "@scure/base@npm:1.1.6" - checksum: d6deaae91deba99e87939af9e55d80edba302674983f32bba57f942e22b1726a83c62dc50d8f4370a5d5d35a212dda167fb169f4b0d0c297488d8604608fc3d3 +"@scure/base@npm:^1.0.0, @scure/base@npm:^1.1.1, @scure/base@npm:^1.1.3, @scure/base@npm:~1.1.3, @scure/base@npm:~1.1.6": + version: 1.1.7 + resolution: "@scure/base@npm:1.1.7" + checksum: d9084be9a2f27971df1684af9e40bb750e86f549345e1bb3227fb61673c0c83569c92c1cb0a4ddccb32650b39d3cd3c145603b926ba751c9bc60c27317549b20 languageName: node linkType: hard -"@scure/bip32@npm:1.3.3": - version: 1.3.3 - resolution: "@scure/bip32@npm:1.3.3" +"@scure/bip32@npm:1.4.0": + version: 1.4.0 + resolution: "@scure/bip32@npm:1.4.0" dependencies: - "@noble/curves": ~1.3.0 - "@noble/hashes": ~1.3.2 - "@scure/base": ~1.1.4 - checksum: f939ca733972622fcc1e61d4fdf170a0ad294b24ddb7ed7cdd4c467e1ef283b970154cb101cf5f1a7b64cf5337e917ad31135911dfc36b1d76625320167df2fa + "@noble/curves": ~1.4.0 + "@noble/hashes": ~1.4.0 + "@scure/base": ~1.1.6 + checksum: eff491651cbf2bea8784936de75af5fc020fc1bbb9bcb26b2cfeefbd1fb2440ebfaf30c0733ca11c0ae1e272a2ef4c3c34ba5c9fb3e1091c3285a4272045b0c6 languageName: node linkType: hard -"@scure/bip39@npm:1.2.2": - version: 1.2.2 - resolution: "@scure/bip39@npm:1.2.2" +"@scure/bip39@npm:1.3.0": + version: 1.3.0 + resolution: "@scure/bip39@npm:1.3.0" dependencies: - "@noble/hashes": ~1.3.2 - "@scure/base": ~1.1.4 - checksum: cb99505e6d2deef8e55e81df8c563ce8dbfdf1595596dc912bceadcf366c91b05a98130e928ecb090df74efdb20150b64acc4be55bc42768cab4d39a2833d234 + "@noble/hashes": ~1.4.0 + "@scure/base": ~1.1.6 + checksum: dbb0b27df753eb6c6380010b25cc9a9ea31f9cb08864fc51e69e5880ff7e2b8f85b72caea1f1f28af165e83b72c48dd38617e43fc632779d025b50ba32ea759e languageName: node linkType: hard @@ -4463,11 +4521,11 @@ __metadata: linkType: hard "@types/babel__traverse@npm:*, @types/babel__traverse@npm:^7.0.4, @types/babel__traverse@npm:^7.0.6": - version: 7.20.5 - resolution: "@types/babel__traverse@npm:7.20.5" + version: 7.20.6 + resolution: "@types/babel__traverse@npm:7.20.6" dependencies: "@babel/types": ^7.20.7 - checksum: 608e0ab4fc31cd47011d98942e6241b34d461608c0c0e153377c5fd822c436c475f1ded76a56bfa76a1adf8d9266b727bbf9bfac90c4cb152c97f30dadc5b7e8 + checksum: 2bdc65eb62232c2d5c1086adeb0c31e7980e6fd7e50a3483b4a724a1a1029c84d9cb59749cf8de612f9afa2bc14c85b8f50e64e21f8a4398fa77eb9059a4283c languageName: node linkType: hard @@ -4497,12 +4555,12 @@ __metadata: linkType: hard "@types/eslint@npm:^8.44.7": - version: 8.56.8 - resolution: "@types/eslint@npm:8.56.8" + version: 8.56.10 + resolution: "@types/eslint@npm:8.56.10" dependencies: "@types/estree": "*" "@types/json-schema": "*" - checksum: b33024ac7bac6d535caa0d5e1f3cdbb527c6b23c10bc3e18d5bc9b6a8b8b593599cb6526fde778e702574b55aac1ab9b2387f22e32ae1a2cb9c569ef29802fc5 + checksum: fb7137dd263ce1130b42d14452bdd0266ef81f52cb55ba1a5e9750e65da1f0596dc598c88bffc7e415458b6cb611a876dcc132bcf40ea48701c6d05b40c57be5 languageName: node linkType: hard @@ -4591,9 +4649,9 @@ __metadata: linkType: hard "@types/lodash@npm:^4.14.191": - version: 4.17.0 - resolution: "@types/lodash@npm:4.17.0" - checksum: 3f98c0b67a93994cbc3403d4fa9dbaf52b0b6bb7f07a764d73875c2dcd5ef91222621bd5bcf8eee7b417a74d175c2f7191b9f595f8603956fd06f0674c0cba93 + version: 4.17.6 + resolution: "@types/lodash@npm:4.17.6" + checksum: f748c672f49c54ee631a0fab6f26d56ab99bd68a4fb91604b5d7525a72102dd1917209c12d7078c988a375edb5dc70ca600db05ac01785306fd64470048cd16c languageName: node linkType: hard @@ -4612,11 +4670,11 @@ __metadata: linkType: hard "@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": - version: 20.14.2 - resolution: "@types/node@npm:20.14.2" + version: 20.14.9 + resolution: "@types/node@npm:20.14.9" dependencies: undici-types: ~5.26.4 - checksum: 265362479b8f3b50fcd1e3f9e9af6121feb01a478dff0335ae67cccc3babfe45d0f12209d3d350595eebd7e67471762697b877c380513f8e5d27a238fa50c805 + checksum: 5e9eda1ac8c6cc6bcd1063903ae195eaede9aad1bdad00408a919409cfbcdd2d6535aa3d50346f0d385528f9e03dafc7d1b3bad25aedb1dcd79a6ad39d06c35d languageName: node linkType: hard @@ -4628,9 +4686,9 @@ __metadata: linkType: hard "@types/node@npm:^16.18.54": - version: 16.18.96 - resolution: "@types/node@npm:16.18.96" - checksum: c5b4c20868e1ecb2e3b975b37aeeb5790b3a4f1472b496fae779ac4f14ba4fb4c0e9ed8e9b6eb389e5a074371056130c9d6506705b144b4f6985ffa844556242 + version: 16.18.101 + resolution: "@types/node@npm:16.18.101" + checksum: d099055168529f56665ad470e0aeb443557301b1342be12eeedcb04897614bbc09ecf10621a90460f83a5264acad4feaf84d0db181251ebe901049aad4ab4bcf languageName: node linkType: hard @@ -4896,60 +4954,60 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-core@npm:3.4.21": - version: 3.4.21 - resolution: "@vue/compiler-core@npm:3.4.21" +"@vue/compiler-core@npm:3.4.30": + version: 3.4.30 + resolution: "@vue/compiler-core@npm:3.4.30" dependencies: - "@babel/parser": ^7.23.9 - "@vue/shared": 3.4.21 + "@babel/parser": ^7.24.7 + "@vue/shared": 3.4.30 entities: ^4.5.0 estree-walker: ^2.0.2 - source-map-js: ^1.0.2 - checksum: 0d6b7732bc5ca5b4561526bbe646f9acd09cd70561b6c822d15856347f21a009ebf30f2f85b1b7500f24f7c0333a2af8ee645c389abe52485c1f4724c982b306 + source-map-js: ^1.2.0 + checksum: 119c2b86cf4c4aa27f4261fdd409d7e9e8cac9c1d8f1a232112840d71c3537f1c3d456c41b6cc951142d6ad784ce2c0623017fc43760b64ba320d833d83dfcc0 languageName: node linkType: hard -"@vue/compiler-dom@npm:3.4.21": - version: 3.4.21 - resolution: "@vue/compiler-dom@npm:3.4.21" +"@vue/compiler-dom@npm:3.4.30": + version: 3.4.30 + resolution: "@vue/compiler-dom@npm:3.4.30" dependencies: - "@vue/compiler-core": 3.4.21 - "@vue/shared": 3.4.21 - checksum: f53e4f4e0afc954cede91a8cbeb3a4e053531a43a0f5999d1b18da443ca3f1f6fc9344a8741c72c5719a61bb34e18004ac88e16747bcf145ebc8a31188263690 + "@vue/compiler-core": 3.4.30 + "@vue/shared": 3.4.30 + checksum: 03833e87e566a0336860487be33c7c0ba7625cab0971552b0ca72c4298c406f33084effdb2e836d8a04392321ea21fd49a25dd7e49c7dbdcf54ecd368c47e625 languageName: node linkType: hard "@vue/compiler-sfc@npm:^3.3.4": - version: 3.4.21 - resolution: "@vue/compiler-sfc@npm:3.4.21" - dependencies: - "@babel/parser": ^7.23.9 - "@vue/compiler-core": 3.4.21 - "@vue/compiler-dom": 3.4.21 - "@vue/compiler-ssr": 3.4.21 - "@vue/shared": 3.4.21 + version: 3.4.30 + resolution: "@vue/compiler-sfc@npm:3.4.30" + dependencies: + "@babel/parser": ^7.24.7 + "@vue/compiler-core": 3.4.30 + "@vue/compiler-dom": 3.4.30 + "@vue/compiler-ssr": 3.4.30 + "@vue/shared": 3.4.30 estree-walker: ^2.0.2 - magic-string: ^0.30.7 - postcss: ^8.4.35 - source-map-js: ^1.0.2 - checksum: 226dc404be96a2811777825918d971feb42650e262159183548d64a463c4153fab97cdc2647224c609c89dbc0d930c6d9dbe6528ef52a1396b4b22163c20569a + magic-string: ^0.30.10 + postcss: ^8.4.38 + source-map-js: ^1.2.0 + checksum: 292e51e27ef7187eeb7b01530ee2b3a85c2369fa244bd2af8fb1b27cb8ea0c01bd0bb7a8b7be5460722918d77654e0c9381c74a062759fe83f035c325db0195e languageName: node linkType: hard -"@vue/compiler-ssr@npm:3.4.21": - version: 3.4.21 - resolution: "@vue/compiler-ssr@npm:3.4.21" +"@vue/compiler-ssr@npm:3.4.30": + version: 3.4.30 + resolution: "@vue/compiler-ssr@npm:3.4.30" dependencies: - "@vue/compiler-dom": 3.4.21 - "@vue/shared": 3.4.21 - checksum: c510bee68b1a5b7f8ae3fe771c10ce9c397f876a234ced9df89e4a8353f3874870857e929cbb37e6d785d355b43f2264dc3a7fd5cb6867dc5b39ddca607ea3ed + "@vue/compiler-dom": 3.4.30 + "@vue/shared": 3.4.30 + checksum: 384ad6d9e999f02f63e060108c25e5d2967ffccf9b9c60826ae2310e6ef4b47fb1248befb974a9223f584338d44e5dfef437e9eb697e827a5fc4fba066e3ccc9 languageName: node linkType: hard -"@vue/shared@npm:3.4.21": - version: 3.4.21 - resolution: "@vue/shared@npm:3.4.21" - checksum: 5f30a408911f339c647baa88c45c3a2f6d58dbdaf2bd404753690f24b612717bdfe9050401d8ffb02613a9a06dd0b43c8307420cd69fda6e92e6d65bf9bc0c6f +"@vue/shared@npm:3.4.30": + version: 3.4.30 + resolution: "@vue/shared@npm:3.4.30" + checksum: c2dd84f69d6172b53bccc45ad45208f1c96e5d374ea836956a8e77324ad3bc8032ddc7595af1877e274645a250d6daed7ba9b4a271da569c86567d1877cf6646 languageName: node linkType: hard @@ -5010,9 +5068,11 @@ __metadata: linkType: hard "acorn-walk@npm:^8.1.1": - version: 8.3.2 - resolution: "acorn-walk@npm:8.3.2" - checksum: 3626b9d26a37b1b427796feaa5261faf712307a8920392c8dce9a5739fb31077667f4ad2ec71c7ac6aaf9f61f04a9d3d67ff56f459587206fc04aa31c27ef392 + version: 8.3.3 + resolution: "acorn-walk@npm:8.3.3" + dependencies: + acorn: ^8.11.0 + checksum: 0f09d351fc30b69b2b9982bf33dc30f3d35a34e030e5f1ed3c49fc4e3814a192bf3101e4c30912a0595410f5e91bb70ddba011ea73398b3ecbfe41c7334c6dd0 languageName: node linkType: hard @@ -5025,12 +5085,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" +"acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": + version: 8.12.0 + resolution: "acorn@npm:8.12.0" bin: acorn: bin/acorn - checksum: 76d8e7d559512566b43ab4aadc374f11f563f0a9e21626dd59cb2888444e9445923ae9f3699972767f18af61df89cd89f5eaaf772d1327b055b45cb829b4a88c + checksum: ae142de8739ef15a5d936c550c1d267fc4dedcdbe62ad1aa2c0009afed1de84dd0a584684a5d200bb55d8db14f3e09a95c6e92a5303973c04b9a7413c36d1df0 languageName: node linkType: hard @@ -5089,14 +5149,14 @@ __metadata: linkType: hard "ajv@npm:^8.0.1": - version: 8.12.0 - resolution: "ajv@npm:8.12.0" + version: 8.16.0 + resolution: "ajv@npm:8.16.0" dependencies: - fast-deep-equal: ^3.1.1 + fast-deep-equal: ^3.1.3 json-schema-traverse: ^1.0.0 require-from-string: ^2.0.2 - uri-js: ^4.2.2 - checksum: 4dc13714e316e67537c8b31bc063f99a1d9d9a497eb4bbd55191ac0dcd5e4985bbb71570352ad6f1e76684fb6d790928f96ba3b2d4fd6e10024be9612fe3f001 + uri-js: ^4.4.1 + checksum: bdf3d4c9f1d11e220850051ef4cd89346e951cfb933d6d41be36d45053c1092af1523ee6c62525cce567355caf0a4f4c19a08a93851649c1fa32b4a39b7c4858 languageName: node linkType: hard @@ -5205,9 +5265,9 @@ __metadata: linkType: hard "apg-js@npm:^4.1.1, apg-js@npm:^4.3.0": - version: 4.3.0 - resolution: "apg-js@npm:4.3.0" - checksum: cc2de379b1683587e6459cab2e7ef9b7b1990dee9e1ced0496b0ceb6c0807a2330ddd4d2b2758f6c3fa9e379a33e55f4b3ad6c1db175f8c32c66cb8e35a651f8 + version: 4.4.0 + resolution: "apg-js@npm:4.4.0" + checksum: 81f9753ef8ec102d6ec7ceddd57a5aee2e7e238ac5877165f9ac6cb5cb8ec73ec5070e040d3af04822bc0de754699b0199c39159ed0d8453d6bb99812a326deb languageName: node linkType: hard @@ -5464,9 +5524,9 @@ __metadata: linkType: hard "bare-events@npm:^2.2.0": - version: 2.2.2 - resolution: "bare-events@npm:2.2.2" - checksum: 154d3fc044cc171d3b85a89b768e626417b60c050123ac2ac10fc002152b4bdeb359ed1453ad54c0f1d05a7786f780d3b976af68e55c09fe4579d8466d3ff256 + version: 2.4.2 + resolution: "bare-events@npm:2.4.2" + checksum: 6cd2b10dd32a3410787e120c091b6082fbc2df0c45ed723a7ae51d0e2f55d2a4037e1daff21dae90b671d36582f9f8d50df337875c281d10adb60df81b8cd861 languageName: node linkType: hard @@ -5607,7 +5667,7 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.2, braces@npm:~3.0.2": +"braces@npm:^3.0.3, braces@npm:~3.0.2": version: 3.0.3 resolution: "braces@npm:3.0.3" dependencies: @@ -5654,16 +5714,16 @@ __metadata: linkType: hard "browserslist@npm:^4.22.2": - version: 4.23.0 - resolution: "browserslist@npm:4.23.0" + version: 4.23.1 + resolution: "browserslist@npm:4.23.1" dependencies: - caniuse-lite: ^1.0.30001587 - electron-to-chromium: ^1.4.668 + caniuse-lite: ^1.0.30001629 + electron-to-chromium: ^1.4.796 node-releases: ^2.0.14 - update-browserslist-db: ^1.0.13 + update-browserslist-db: ^1.0.16 bin: browserslist: cli.js - checksum: 436f49e796782ca751ebab7edc010cfc9c29f68536f387666cd70ea22f7105563f04dd62c6ff89cb24cc3254d17cba385f979eeeb3484d43e012412ff7e75def + checksum: 06189e2d6666a203ce097cc0e713a40477d08420927b79af139211e5712f3cf676fdc4dd6af3aa493d47c09206a344b3420a8315577dbe88c58903132de9b0f5 languageName: node linkType: hard @@ -5739,7 +5799,7 @@ __metadata: languageName: node linkType: hard -"builtins@npm:^5.0.0, builtins@npm:^5.0.1": +"builtins@npm:^5.0.1": version: 5.1.0 resolution: "builtins@npm:5.1.0" dependencies: @@ -5749,13 +5809,13 @@ __metadata: linkType: hard "bundle-require@npm:^4.0.0": - version: 4.0.2 - resolution: "bundle-require@npm:4.0.2" + version: 4.2.1 + resolution: "bundle-require@npm:4.2.1" dependencies: load-tsconfig: ^0.2.3 peerDependencies: esbuild: ">=0.17" - checksum: 13a78ac0aee0f33614c24f2747167c7faebef6c9d1d5453b464fc85fa164a3a3aab657b2b31b7b5d2a088e4958676fef0454328ff7baddd6bfb03a8ff8d8b928 + checksum: dcf97683772bd9b1461bde9ba83d2dc0f13c5d7aeecfc9d6e3678b21eeb859a03ee815db03ed14af9d7b1311f39e99ce0487d6f67f9244381436eecf478c9a2c languageName: node linkType: hard @@ -5767,8 +5827,8 @@ __metadata: linkType: hard "cacache@npm:^18.0.0": - version: 18.0.2 - resolution: "cacache@npm:18.0.2" + version: 18.0.3 + resolution: "cacache@npm:18.0.3" dependencies: "@npmcli/fs": ^3.1.0 fs-minipass: ^3.0.0 @@ -5782,7 +5842,7 @@ __metadata: ssri: ^10.0.0 tar: ^6.1.11 unique-filename: ^3.0.0 - checksum: 0250df80e1ad0c828c956744850c5f742c24244e9deb5b7dc81bca90f8c10e011e132ecc58b64497cc1cad9a98968676147fb6575f4f94722f7619757b17a11b + checksum: b717fd9b36e9c3279bfde4545c3a8f6d5a539b084ee26a9504d48f83694beb724057d26e090b97540f9cc62bea18b9f6cf671c50e18fb7dac60eda9db691714f languageName: node linkType: hard @@ -5834,10 +5894,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001587": - version: 1.0.30001608 - resolution: "caniuse-lite@npm:1.0.30001608" - checksum: 7ae62689ca358cd3bdb89b2db9b4841812299f8a0b3ab94b52e4548778bd5740814617c0e0b2504b6bfaf47acc2472e1730393bd2027d646acbe8dc8206ad9e7 +"caniuse-lite@npm:^1.0.30001629": + version: 1.0.30001638 + resolution: "caniuse-lite@npm:1.0.30001638" + checksum: 82e47b2bfac107c662e03bfd3321bfd9493f87240c77a9bfba7ea2cc9e0b81d9238152aed903fb19e60557879e4f48b57e2c6300677391b92a060fbf0a340e30 languageName: node linkType: hard @@ -5934,9 +5994,9 @@ __metadata: linkType: hard "cjs-module-lexer@npm:^1.0.0": - version: 1.2.3 - resolution: "cjs-module-lexer@npm:1.2.3" - checksum: 5ea3cb867a9bb609b6d476cd86590d105f3cfd6514db38ff71f63992ab40939c2feb68967faa15a6d2b1f90daa6416b79ea2de486e9e2485a6f8b66a21b4fb0a + version: 1.3.1 + resolution: "cjs-module-lexer@npm:1.3.1" + checksum: 75f20ac264a397ea5c63f9c2343a51ab878043666468f275e94862f7180ec1d764a400ec0c09085dcf0db3193c74a8b571519abd2bf4be0d2be510d1377c8d4b languageName: node linkType: hard @@ -6007,9 +6067,9 @@ __metadata: linkType: hard "cmd-shim@npm:^6.0.0": - version: 6.0.2 - resolution: "cmd-shim@npm:6.0.2" - checksum: df3a01fc4d72a49b450985b991205e65774b28e7f74a2e4d2a11fd0df8732e3828f9e7b644050def3cd0be026cbd3ee46a1f50ce5f57d0b3fb5afe335bdfacde + version: 6.0.3 + resolution: "cmd-shim@npm:6.0.3" + checksum: bd79ac1505fea77cba0caf271c16210ebfbe50f348a1907f4700740876ab2157e00882b9baa685a9fcf9bc92e08a87e21bd757f45a6938f00290422f80f7d27a languageName: node linkType: hard @@ -6021,9 +6081,9 @@ __metadata: linkType: hard "cockatiel@npm:^3.1.2": - version: 3.1.2 - resolution: "cockatiel@npm:3.1.2" - checksum: 5ba2d9ffd738d38c5f1af66f4c36f302485f4ebf25b96e47aa9c9ea3fecd47ed770bfc9da52ac58bef3dfb330efd7e9be557691b4e620a1479d79009bff2b74e + version: 3.1.3 + resolution: "cockatiel@npm:3.1.3" + checksum: ed5fccd2c441a79ac32026c304b09cd2c281367cedfcc867088abb8e36aa59ca49b0da9d228f1569f96d72b53645d3414a6cf2a8ad40075becdb6532fbe61acb languageName: node linkType: hard @@ -6130,11 +6190,11 @@ __metadata: linkType: hard "contentful-resolve-response@npm:^1.8.1": - version: 1.8.1 - resolution: "contentful-resolve-response@npm:1.8.1" + version: 1.8.2 + resolution: "contentful-resolve-response@npm:1.8.2" dependencies: fast-copy: ^2.1.7 - checksum: 59d9085529cc1a371d0b9e218b5dbb2efdec3b339672e6f4f150884778ce990c32decb68b6cdf645fe4b9741e4078aae0f7290b20e13e8d91fd4c97d84aca60a + checksum: 699c5fc5b14cc3d7847209f8face805adb6e0c3b4faf1f83d2bb54f8d1e621afb57e543028f1d79506b852d65868a03b4ef31929684fe06240694aa7bcf245cf languageName: node linkType: hard @@ -6152,17 +6212,17 @@ __metadata: linkType: hard "contentful@npm:^10.3.6": - version: 10.11.11 - resolution: "contentful@npm:10.11.11" + version: 10.12.4 + resolution: "contentful@npm:10.12.4" dependencies: - "@contentful/content-source-maps": ^0.5.0 + "@contentful/content-source-maps": ^0.6.0 "@contentful/rich-text-types": ^16.0.2 axios: ~1.6.8 contentful-resolve-response: ^1.8.1 contentful-sdk-core: ^8.1.0 json-stringify-safe: ^5.0.1 type-fest: ^4.0.0 - checksum: 061b1b71c25ff38ac3b2968027c610d8d8d5b4b0de5dfe4f2e6546fd3c16fe0f64b54860564848c64ddb0bd9f1a8d8ef3876f95c75305577c3e32696b77e926c + checksum: 14d013a3ec218af508ab5b9a0cbd65d102ae8c4d1267b4142d027221e6a21198c94c34bea716c24f132642693864ed743c5c8d922386432ed3dc7eeff006cecd languageName: node linkType: hard @@ -6333,14 +6393,14 @@ __metadata: linkType: hard "debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4": - version: 4.3.4 - resolution: "debug@npm:4.3.4" + version: 4.3.5 + resolution: "debug@npm:4.3.5" dependencies: ms: 2.1.2 peerDependenciesMeta: supports-color: optional: true - checksum: 3dbad3f94ea64f34431a9cbf0bafb61853eda57bff2880036153438f50fb5a84f27683ba0d8e5426bf41a8c6ff03879488120cf5b3a761e77953169c0600a708 + checksum: 7c002b51e256257f936dda09eb37167df952758c57badf6bf44bdc40b89a4bcb8e5a0a2e4c7b53f97c69e2970dd5272d33a757378a12c8f8e64ea7bf99e8e86e languageName: node linkType: hard @@ -6581,10 +6641,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.4.668": - version: 1.4.733 - resolution: "electron-to-chromium@npm:1.4.733" - checksum: 2fd0efec8f3d7c1a503dd57b18a66ee73f5515e641278b50704833c37543e23a5b03f25a98b75fba06397dd66be70ed5bd7804dafaf9fede4e50dec2b4ca9fd1 +"electron-to-chromium@npm:^1.4.796": + version: 1.4.812 + resolution: "electron-to-chromium@npm:1.4.812" + checksum: 0205fcb6db3a719873398f46cd3341188d4a54e056567453819532c5fd1fadda43f501c252bc8d05eeaaeb1497f58d9875c46c4f9ecfbe713b9efe71cd879b13 languageName: node linkType: hard @@ -6878,7 +6938,7 @@ __metadata: languageName: node linkType: hard -"escalade@npm:^3.1.1": +"escalade@npm:^3.1.1, escalade@npm:^3.1.2": version: 3.1.2 resolution: "escalade@npm:3.1.2" checksum: 1ec0977aa2772075493002bdbd549d595ff6e9393b1cb0d7d6fcaf78c750da0c158f180938365486f75cb69fba20294351caddfce1b46552a7b6c3cde52eaa02 @@ -7120,11 +7180,11 @@ __metadata: linkType: hard "eslint-plugin-promise@npm:^6.1.1": - version: 6.1.1 - resolution: "eslint-plugin-promise@npm:6.1.1" + version: 6.2.0 + resolution: "eslint-plugin-promise@npm:6.2.0" peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - checksum: 46b9a4f79dae5539987922afc27cc17cbccdecf4f0ba19c0ccbf911b0e31853e9f39d9959eefb9637461b52772afa1a482f1f87ff16c1ba38bdb6fcf21897e9a + eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 + checksum: 4ce2ee365044aaeac7feb7c4b62f7d432594960bf96be703f871fa5fdd61f358d6620222e7c907f7ee43ff54b0b2ff392c1f70680bce335f6396c8c7af79c141 languageName: node linkType: hard @@ -7359,14 +7419,14 @@ __metadata: linkType: hard "ethereum-cryptography@npm:^2.0.0, ethereum-cryptography@npm:^2.1.2": - version: 2.1.3 - resolution: "ethereum-cryptography@npm:2.1.3" + version: 2.2.0 + resolution: "ethereum-cryptography@npm:2.2.0" dependencies: - "@noble/curves": 1.3.0 - "@noble/hashes": 1.3.3 - "@scure/bip32": 1.3.3 - "@scure/bip39": 1.2.2 - checksum: 7f9c14f868a588641179cace3eb86c332c4743290865db699870710253cabc4dc74bd4bce5e7bc6db667482e032e94d6f79521219eb6be5dc422059d279a27b7 + "@noble/curves": 1.4.0 + "@noble/hashes": 1.4.0 + "@scure/bip32": 1.4.0 + "@scure/bip39": 1.3.0 + checksum: 529d05a47fe0ff86ab36022a286c3a280e09d386fc92ff183aa4b095e97d190dd875022a004898686a798bac56e73601dd91356298edc56e5eeded7846f8ec12 languageName: node linkType: hard @@ -7400,8 +7460,8 @@ __metadata: linkType: hard "ethers@npm:^6.12.0": - version: 6.12.1 - resolution: "ethers@npm:6.12.1" + version: 6.13.1 + resolution: "ethers@npm:6.13.1" dependencies: "@adraffy/ens-normalize": 1.10.1 "@noble/curves": 1.2.0 @@ -7409,8 +7469,8 @@ __metadata: "@types/node": 18.15.13 aes-js: 4.0.0-beta.5 tslib: 2.4.0 - ws: 8.5.0 - checksum: ddf398c91f584b9e643740ec17a9c82b4a1c4ea3fb6efd00f1a043b89d1ec6f9427aa80894f75850ee805722e91b8d054bce18579a2c621226302c096774df90 + ws: 8.17.1 + checksum: beef4b6d117f64c369f44be631e0f666b966374eac0cc0446fa7abe114b11d6b3019060022eec65c031f150711f4913d249de507ff3da3204e654635db80a07e languageName: node linkType: hard @@ -7549,6 +7609,17 @@ __metadata: languageName: node linkType: hard +"extension-port-stream@npm:^4.1.0": + version: 4.1.0 + resolution: "extension-port-stream@npm:4.1.0" + dependencies: + readable-stream: ^3.6.2 || ^4.4.2 + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: e349277cf65a89c2a6c4f3611f52e0a97497bd2870a4c25aa4ab11b300c48e3013fd95208e3ff6c8494dfb849eed725e7506e59118b1a69e555fa4b67afdbd83 + languageName: node + linkType: hard + "fast-copy@npm:^2.1.7": version: 2.1.7 resolution: "fast-copy@npm:2.1.7" @@ -7570,7 +7641,7 @@ __metadata: languageName: node linkType: hard -"fast-fifo@npm:^1.1.0, fast-fifo@npm:^1.2.0": +"fast-fifo@npm:^1.2.0, fast-fifo@npm:^1.3.2": version: 1.3.2 resolution: "fast-fifo@npm:1.3.2" checksum: 6bfcba3e4df5af7be3332703b69a7898a8ed7020837ec4395bb341bd96cc3a6d86c3f6071dd98da289618cf2234c70d84b2a6f09a33dd6f988b1ff60d8e54275 @@ -7619,13 +7690,13 @@ __metadata: linkType: hard "fast-xml-parser@npm:^4.3.4": - version: 4.3.6 - resolution: "fast-xml-parser@npm:4.3.6" + version: 4.4.0 + resolution: "fast-xml-parser@npm:4.4.0" dependencies: strnum: ^1.0.5 bin: fxparser: src/cli/cli.js - checksum: 12795c55f4564699c3cee13f7e892423244ac1125775e9b85bf948a1d4b65352da8f688d334bad530972288bb7ee0cf3d2605088d475123fce40d95003f045fa + checksum: ad33a4b5165a0ffcb6e17ae78825bd4619a8298844a8a8408f2ea141a0d2d9439d18865dc5254162f09fe54d510ff18e5d5c0a190869cab21fc745ee66be816b languageName: node linkType: hard @@ -7813,12 +7884,12 @@ __metadata: linkType: hard "foreground-child@npm:^3.1.0": - version: 3.1.1 - resolution: "foreground-child@npm:3.1.1" + version: 3.2.1 + resolution: "foreground-child@npm:3.2.1" dependencies: cross-spawn: ^7.0.0 signal-exit: ^4.0.1 - checksum: 139d270bc82dc9e6f8bc045fe2aae4001dc2472157044fdfad376d0a3457f77857fa883c1c8b21b491c6caade9a926a4bed3d3d2e8d3c9202b151a4cbbd0bcd5 + checksum: 3e2e844d6003c96d70affe8ae98d7eaaba269a868c14d997620c088340a8775cd5d2d9043e6ceebae1928d8d9a874911c4d664b9a267e8995945df20337aebc0 languageName: node linkType: hard @@ -8012,33 +8083,19 @@ __metadata: languageName: node linkType: hard -"glob@npm:^10.2.2, glob@npm:^10.3.10": - version: 10.3.12 - resolution: "glob@npm:10.3.12" - dependencies: - foreground-child: ^3.1.0 - jackspeak: ^2.3.6 - minimatch: ^9.0.1 - minipass: ^7.0.4 - path-scurry: ^1.10.2 - bin: - glob: dist/esm/bin.mjs - checksum: 2b0949d6363021aaa561b108ac317bf5a97271b8a5d7a5fac1a176e40e8068ecdcccc992f8a7e958593d501103ac06d673de92adc1efcbdab45edefe35f8d7c6 - languageName: node - linkType: hard - -"glob@npm:^10.3.7": - version: 10.4.1 - resolution: "glob@npm:10.4.1" +"glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.7": + version: 10.4.2 + resolution: "glob@npm:10.4.2" dependencies: foreground-child: ^3.1.0 jackspeak: ^3.1.2 minimatch: ^9.0.4 minipass: ^7.1.2 + package-json-from-dist: ^1.0.0 path-scurry: ^1.11.1 bin: glob: dist/esm/bin.mjs - checksum: 5d33c686c80bf6877f4284adf99a8c3cbb2a6eccbc92342943fe5d4b42c01d78c1881f2223d950c92a938d0f857e12e37b86a8e5483ab2141822e053b67d0dde + checksum: bd7c0e30701136e936f414e5f6f82c7f04503f01df77408f177aa584927412f0bde0338e6ec541618cd21eacc57dde33e7b3c6c0a779cc1c6e6a0e14f3d15d9b languageName: node linkType: hard @@ -8106,11 +8163,12 @@ __metadata: linkType: hard "globalthis@npm:^1.0.3": - version: 1.0.3 - resolution: "globalthis@npm:1.0.3" + version: 1.0.4 + resolution: "globalthis@npm:1.0.4" dependencies: - define-properties: ^1.1.3 - checksum: fbd7d760dc464c886d0196166d92e5ffb4c84d0730846d6621a39fbbc068aeeb9c8d1421ad330e94b7bca4bb4ea092f5f21f3d36077812af5d098b4dc006c998 + define-properties: ^1.2.1 + gopd: ^1.0.1 + checksum: 39ad667ad9f01476474633a1834a70842041f70a55571e8dcef5fb957980a92da5022db5430fca8aecc5d47704ae30618c0bc877a579c70710c904e9ef06108a languageName: node linkType: hard @@ -8287,11 +8345,11 @@ __metadata: linkType: hard "hosted-git-info@npm:^7.0.0": - version: 7.0.1 - resolution: "hosted-git-info@npm:7.0.1" + version: 7.0.2 + resolution: "hosted-git-info@npm:7.0.2" dependencies: lru-cache: ^10.0.1 - checksum: be5280f0a20d6153b47e1ab578e09f5ae8ad734301b3ed7e547dc88a6814d7347a4888db1b4f9635cc738e3c0ef1fbff02272aba7d07c75d4c5a50ff8d618db6 + checksum: 467cf908a56556417b18e86ae3b8dee03c2360ef1d51e61c4028fe87f6f309b6ff038589c94b5666af207da9d972d5107698906aabeb78aca134641962a5c6f8 languageName: node linkType: hard @@ -8597,11 +8655,11 @@ __metadata: linkType: hard "is-core-module@npm:^2.11.0, is-core-module@npm:^2.12.0, is-core-module@npm:^2.13.0, is-core-module@npm:^2.8.1": - version: 2.13.1 - resolution: "is-core-module@npm:2.13.1" + version: 2.14.0 + resolution: "is-core-module@npm:2.14.0" dependencies: - hasown: ^2.0.0 - checksum: 256559ee8a9488af90e4bad16f5583c6d59e92f0742e9e8bb4331e758521ee86b810b93bae44f390766ffbc518a0488b18d9dab7da9a5ff997d499efc9403f7c + hasown: ^2.0.2 + checksum: 6bba6c8dc99d88d6f3b2746709d82caddcd9565cafd5870e28ab320720e27e6d9d2bb953ba0839ed4d2ee264bfdd14a9fa1bbc242a916f7dacc8aa95f0322256 languageName: node linkType: hard @@ -8934,29 +8992,16 @@ __metadata: languageName: node linkType: hard -"jackspeak@npm:^2.3.6": - version: 2.3.6 - resolution: "jackspeak@npm:2.3.6" - dependencies: - "@isaacs/cliui": ^8.0.2 - "@pkgjs/parseargs": ^0.11.0 - dependenciesMeta: - "@pkgjs/parseargs": - optional: true - checksum: 57d43ad11eadc98cdfe7496612f6bbb5255ea69fe51ea431162db302c2a11011642f50cfad57288bd0aea78384a0612b16e131944ad8ecd09d619041c8531b54 - languageName: node - linkType: hard - "jackspeak@npm:^3.1.2": - version: 3.1.2 - resolution: "jackspeak@npm:3.1.2" + version: 3.4.0 + resolution: "jackspeak@npm:3.4.0" dependencies: "@isaacs/cliui": ^8.0.2 "@pkgjs/parseargs": ^0.11.0 dependenciesMeta: "@pkgjs/parseargs": optional: true - checksum: 134276d5f785c518930701a0dcba1f3b0e9ce3e5b1c3e300898e2ae0bbd9b5195088b77252bf2110768de072c426e9e39f47e13912b0b002da4a3f4ff6e16eac + checksum: 350f6f311018bb175ffbe736b19c26ac0b134bb5a17a638169e89594eb0c24ab1c658ab3a2fda24ff63b3b19292e1a5ec19d2255bc526df704e8168d392bef85 languageName: node linkType: hard @@ -9707,9 +9752,9 @@ __metadata: linkType: hard "json-parse-even-better-errors@npm:^3.0.0": - version: 3.0.1 - resolution: "json-parse-even-better-errors@npm:3.0.1" - checksum: bf74fa3f715e56699ccd68b80a7d20908de432a3fae2d5aa2ed530a148e9d9ccdf8e6983b93d9966a553aa70dcf003ce3a7ffec2c0ce74d2a6173e3691a426f0 + version: 3.0.2 + resolution: "json-parse-even-better-errors@npm:3.0.2" + checksum: 6f04ea6c9ccb783630a59297959247e921cc90b917b8351197ca7fd058fccc7079268fd9362be21ba876fc26aa5039369dd0a2280aae49aae425784794a94927 languageName: node linkType: hard @@ -9778,9 +9823,9 @@ __metadata: linkType: hard "jsonc-parser@npm:^3.2.0": - version: 3.2.1 - resolution: "jsonc-parser@npm:3.2.1" - checksum: 656d9027b91de98d8ab91b3aa0d0a4cab7dc798a6830845ca664f3e76c82d46b973675bbe9b500fae1de37fd3e81aceacbaa2a57884bf2f8f29192150d2d1ef7 + version: 3.3.1 + resolution: "jsonc-parser@npm:3.3.1" + checksum: 81ef19d98d9c6bd6e4a37a95e2753c51c21705cbeffd895e177f4b542cca9cda5fda12fb942a71a2e824a9132cf119dc2e642e9286386055e1365b5478f49a47 languageName: node linkType: hard @@ -9851,9 +9896,9 @@ __metadata: linkType: hard "lilconfig@npm:^3.0.0": - version: 3.1.1 - resolution: "lilconfig@npm:3.1.1" - checksum: dc8a4f4afde3f0fac6bd36163cc4777a577a90759b8ef1d0d766b19ccf121f723aa79924f32af5b954f3965268215e046d0f237c41c76e5ef01d4e6d1208a15e + version: 3.1.2 + resolution: "lilconfig@npm:3.1.2" + checksum: 4e8b83ddd1d0ad722600994e6ba5d858ddca14f0587aa6b9c8185e17548149b5e13d4d583d811e9e9323157fa8c6a527e827739794c7502b59243c58e210b8c3 languageName: node linkType: hard @@ -9986,9 +10031,9 @@ __metadata: linkType: hard "lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": - version: 10.2.0 - resolution: "lru-cache@npm:10.2.0" - checksum: eee7ddda4a7475deac51ac81d7dd78709095c6fa46e8350dc2d22462559a1faa3b81ed931d5464b13d48cbd7e08b46100b6f768c76833912bc444b99c37e25db + version: 10.2.2 + resolution: "lru-cache@npm:10.2.2" + checksum: 98e8fc93691c546f719a76103ef2bee5a3ac823955c755a47641ec41f8c7fafa1baeaba466937cc1cbfa9cfd47e03536d10e2db3158a64ad91ff3a58a32c893e languageName: node linkType: hard @@ -10001,15 +10046,6 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^6.0.0": - version: 6.0.0 - resolution: "lru-cache@npm:6.0.0" - dependencies: - yallist: ^4.0.0 - checksum: f97f499f898f23e4585742138a22f22526254fdba6d75d41a1c2526b3b6cc5747ef59c5612ba7375f42aca4f8461950e925ba08c991ead0651b4918b7c978297 - languageName: node - linkType: hard - "lunr@npm:^2.3.9": version: 2.3.9 resolution: "lunr@npm:2.3.9" @@ -10024,7 +10060,7 @@ __metadata: languageName: node linkType: hard -"magic-string@npm:^0.30.7": +"magic-string@npm:^0.30.10": version: 0.30.10 resolution: "magic-string@npm:0.30.10" dependencies: @@ -10050,8 +10086,8 @@ __metadata: linkType: hard "make-fetch-happen@npm:^13.0.0": - version: 13.0.0 - resolution: "make-fetch-happen@npm:13.0.0" + version: 13.0.1 + resolution: "make-fetch-happen@npm:13.0.1" dependencies: "@npmcli/agent": ^2.0.0 cacache: ^18.0.0 @@ -10062,9 +10098,10 @@ __metadata: minipass-flush: ^1.0.5 minipass-pipeline: ^1.2.4 negotiator: ^0.6.3 + proc-log: ^4.2.0 promise-retry: ^2.0.1 ssri: ^10.0.0 - checksum: 7c7a6d381ce919dd83af398b66459a10e2fe8f4504f340d1d090d3fa3d1b0c93750220e1d898114c64467223504bd258612ba83efbc16f31b075cd56de24b4af + checksum: 5c9fad695579b79488fa100da05777213dd9365222f85e4757630f8dd2a21a79ddd3206c78cfd6f9b37346819681782b67900ac847a57cf04190f52dda5343fd languageName: node linkType: hard @@ -10078,11 +10115,11 @@ __metadata: linkType: hard "marked@npm:^12.0.1": - version: 12.0.1 - resolution: "marked@npm:12.0.1" + version: 12.0.2 + resolution: "marked@npm:12.0.2" bin: marked: bin/marked.js - checksum: 35ebc6c4612fcc028a1cd6419321e336be5b29d3feb68dfd5aaa7fcddb399c7873cd3291d60daf342db3eede747757e4e18515f349f0ee7b84ec24254f3a4190 + checksum: 966422e2ba519294aa657bacb2e51784e4b641c1c8f15bdf9315878993c4ea09fe0d00ba2da761e443a3c52cc285c452644fd107ab0f356669bd5aac08d5c0bd languageName: node linkType: hard @@ -10128,12 +10165,12 @@ __metadata: linkType: hard "micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": - version: 4.0.5 - resolution: "micromatch@npm:4.0.5" + version: 4.0.7 + resolution: "micromatch@npm:4.0.7" dependencies: - braces: ^3.0.2 + braces: ^3.0.3 picomatch: ^2.3.1 - checksum: 02a17b671c06e8fefeeb6ef996119c1e597c942e632a21ef589154f23898c9c6a9858526246abb14f8bca6e77734aa9dcf65476fca47cedfb80d9577d52843fc + checksum: 3cde047d70ad80cf60c787b77198d680db3b8c25b23feb01de5e2652205d9c19f43bd81882f69a0fd1f0cde6a7a122d774998aad3271ddb1b8accf8a0f480cf7 languageName: node linkType: hard @@ -10199,12 +10236,12 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.0, minimatch@npm:^9.0.1, minimatch@npm:^9.0.4": - version: 9.0.4 - resolution: "minimatch@npm:9.0.4" +"minimatch@npm:^9.0.0, minimatch@npm:^9.0.4": + version: 9.0.5 + resolution: "minimatch@npm:9.0.5" dependencies: brace-expansion: ^2.0.1 - checksum: cf717f597ec3eed7dabc33153482a2e8d49f4fd3c26e58fd9c71a94c5029a0838728841b93f46bf1263b65a8010e2ee800d0dc9b004ab8ba8b6d1ec07cc115b5 + checksum: 2c035575eda1e50623c731ec6c14f65a85296268f749b9337005210bb2b34e2705f8ef1a358b188f69892286ab99dc42c8fb98a57bde55c8d81b3023c19cea28 languageName: node linkType: hard @@ -10225,8 +10262,8 @@ __metadata: linkType: hard "minipass-fetch@npm:^3.0.0": - version: 3.0.4 - resolution: "minipass-fetch@npm:3.0.4" + version: 3.0.5 + resolution: "minipass-fetch@npm:3.0.5" dependencies: encoding: ^0.1.13 minipass: ^7.0.3 @@ -10235,7 +10272,7 @@ __metadata: dependenciesMeta: encoding: optional: true - checksum: af7aad15d5c128ab1ebe52e043bdf7d62c3c6f0cecb9285b40d7b395e1375b45dcdfd40e63e93d26a0e8249c9efd5c325c65575aceee192883970ff8cb11364a + checksum: 8047d273236157aab27ab7cd8eab7ea79e6ecd63e8f80c3366ec076cb9a0fed550a6935bab51764369027c414647fd8256c2a20c5445fb250c483de43350de83 languageName: node linkType: hard @@ -10282,14 +10319,7 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4": - version: 7.0.4 - resolution: "minipass@npm:7.0.4" - checksum: 87585e258b9488caf2e7acea242fd7856bbe9a2c84a7807643513a338d66f368c7d518200ad7b70a508664d408aa000517647b2930c259a8b1f9f0984f344a21 - languageName: node - linkType: hard - -"minipass@npm:^7.1.2": +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.1.2": version: 7.1.2 resolution: "minipass@npm:7.1.2" checksum: 2bfd325b95c555f2b4d2814d49325691c7bee937d753814861b0b49d5edcda55cbbf22b6b6a60bb91eddac8668771f03c5ff647dcd9d0f798e9548b9cdc46ee3 @@ -10337,9 +10367,9 @@ __metadata: linkType: hard "multiformats@npm:^13.1.0": - version: 13.1.0 - resolution: "multiformats@npm:13.1.0" - checksum: b970e3622a80192a4df8c23378c4854520df8b2d17db773ac8b77c19750019e1c9813cc05e12b0e3b0d03599ff5d073681e847d43b4b273efca5aabbb28eb0e0 + version: 13.1.1 + resolution: "multiformats@npm:13.1.1" + checksum: 99021070bdcfcfef22d0a944fdcaab3ae3e47ee88005b5ec5aafea4eefcc168874b2cbe5a9abc901fd8b515d1461f3c335155a0a6a49b72c93df29b48d253954 languageName: node linkType: hard @@ -10452,13 +10482,13 @@ __metadata: linkType: hard "node-gyp-build@npm:^4.2.0": - version: 4.8.0 - resolution: "node-gyp-build@npm:4.8.0" + version: 4.8.1 + resolution: "node-gyp-build@npm:4.8.1" bin: node-gyp-build: bin.js node-gyp-build-optional: optional.js node-gyp-build-test: build-test.js - checksum: b82a56f866034b559dd3ed1ad04f55b04ae381b22ec2affe74b488d1582473ca6e7f85fccf52da085812d3de2b0bf23109e752a57709ac7b9963951c710fea40 + checksum: fe6e95da6f4608c1a98655f6bf2fe4e8dd9c877cd13256056a8acaf585cc7f98718823fe9366be11b78c2f332d5a184b00cf07a4af96c9d8fea45f640c019f98 languageName: node linkType: hard @@ -10497,25 +10527,24 @@ __metadata: linkType: hard "nopt@npm:^7.0.0": - version: 7.2.0 - resolution: "nopt@npm:7.2.0" + version: 7.2.1 + resolution: "nopt@npm:7.2.1" dependencies: abbrev: ^2.0.0 bin: nopt: bin/nopt.js - checksum: a9c0f57fb8cb9cc82ae47192ca2b7ef00e199b9480eed202482c962d61b59a7fbe7541920b2a5839a97b42ee39e288c0aed770e38057a608d7f579389dfde410 + checksum: 6fa729cc77ce4162cfad8abbc9ba31d4a0ff6850c3af61d59b505653bef4781ec059f8890ecfe93ee8aa0c511093369cca88bfc998101616a2904e715bbbb7c9 languageName: node linkType: hard "normalize-package-data@npm:^6.0.0": - version: 6.0.0 - resolution: "normalize-package-data@npm:6.0.0" + version: 6.0.2 + resolution: "normalize-package-data@npm:6.0.2" dependencies: hosted-git-info: ^7.0.0 - is-core-module: ^2.8.1 semver: ^7.3.5 validate-npm-package-license: ^3.0.4 - checksum: 741211a4354ba6d618caffa98f64e0e5ec9e5575bf3aefe47f4b68e662d65f9ba1b6b2d10640c16254763ed0879288155566138b5ffe384172352f6e969c1752 + checksum: ea35f8de68e03fc845f545c8197857c0cd256207fdb809ca63c2b39fe76ae77765ee939eb21811fb6c3b533296abf49ebe3cd617064f98a775adaccb24ff2e03 languageName: node linkType: hard @@ -10543,26 +10572,26 @@ __metadata: linkType: hard "npm-package-arg@npm:^11.0.0": - version: 11.0.1 - resolution: "npm-package-arg@npm:11.0.1" + version: 11.0.2 + resolution: "npm-package-arg@npm:11.0.2" dependencies: hosted-git-info: ^7.0.0 - proc-log: ^3.0.0 + proc-log: ^4.0.0 semver: ^7.3.5 validate-npm-package-name: ^5.0.0 - checksum: 60364504e04e34fc20b47ad192efc9181922bce0cb41fa81871b1b75748d8551725f61b2f9a2e3dffb1782d749a35313f5dc02c18c3987653990d486f223adf2 + checksum: cb78da54d42373fc87fcecfc68e74b10be02fea940becddf9fdcc8941334a5d57b5e867da2647e8b74880e1dc2b212d0fcc963fafd41cbccca8da3a1afef5b12 languageName: node linkType: hard "npm-pick-manifest@npm:^9.0.0": - version: 9.0.0 - resolution: "npm-pick-manifest@npm:9.0.0" + version: 9.0.1 + resolution: "npm-pick-manifest@npm:9.0.1" dependencies: npm-install-checks: ^6.0.0 npm-normalize-package-bin: ^3.0.0 npm-package-arg: ^11.0.0 semver: ^7.3.5 - checksum: a6f102f9e9e8feea69be3a65e492fef6319084a85fc4e40dc88a277a3aa675089cef13ab0436ed7916e97c7bbba8315633d818eb15402c3abfb0bddc1af08cc7 + checksum: acd53d99cb72b39dd2e6aefe32c08a0ba969622911865ff86555dba0cd6e67ca43ae72fd1962084e4344d88596f4faf75128b70347beb29613720445d4063c87 languageName: node linkType: hard @@ -10595,9 +10624,9 @@ __metadata: linkType: hard "nwsapi@npm:^2.2.0": - version: 2.2.7 - resolution: "nwsapi@npm:2.2.7" - checksum: cab25f7983acec7e23490fec3ef7be608041b460504229770e3bfcf9977c41d6fe58f518994d3bd9aa3a101f501089a3d4a63536f4ff8ae4b8c4ca23bdbfda4e + version: 2.2.10 + resolution: "nwsapi@npm:2.2.10" + checksum: 5f1d361b38c47ab49727d5ea8bbfeb5867ae6de0e538eec9a8b77c88005ddde36d8b930e0730b50ee5e5dda949112c0f9ffed1bf15e7e1b3cd9cfa319f5a9b6f languageName: node linkType: hard @@ -10609,9 +10638,9 @@ __metadata: linkType: hard "object-inspect@npm:^1.13.1": - version: 1.13.1 - resolution: "object-inspect@npm:1.13.1" - checksum: 7d9fa9221de3311dcb5c7c307ee5dc011cdd31dc43624b7c184b3840514e118e05ef0002be5388304c416c0eb592feb46e983db12577fc47e47d5752fbbfb61f + version: 1.13.2 + resolution: "object-inspect@npm:1.13.2" + checksum: 9f850b3c045db60e0e97746e809ee4090d6ce62195af17dd1e9438ac761394a7d8ec4f7906559aea5424eaf61e35d3e53feded2ccd5f62fcc7d9670d3c8eb353 languageName: node linkType: hard @@ -10683,16 +10712,16 @@ __metadata: linkType: hard "optionator@npm:^0.9.3": - version: 0.9.3 - resolution: "optionator@npm:0.9.3" + version: 0.9.4 + resolution: "optionator@npm:0.9.4" dependencies: - "@aashutoshrathi/word-wrap": ^1.2.3 deep-is: ^0.1.3 fast-levenshtein: ^2.0.6 levn: ^0.4.1 prelude-ls: ^1.2.1 type-check: ^0.4.0 - checksum: 09281999441f2fe9c33a5eeab76700795365a061563d66b098923eb719251a42bdbe432790d35064d0816ead9296dbeb1ad51a733edf4167c96bd5d0882e428a + word-wrap: ^1.2.5 + checksum: ecbd010e3dc73e05d239976422d9ef54a82a13f37c11ca5911dff41c98a6c7f0f163b27f922c37e7f8340af9d36febd3b6e9cef508f3339d4c393d7276d716bb languageName: node linkType: hard @@ -10790,6 +10819,13 @@ __metadata: languageName: node linkType: hard +"package-json-from-dist@npm:^1.0.0": + version: 1.0.0 + resolution: "package-json-from-dist@npm:1.0.0" + checksum: ac706ec856a5a03f5261e4e48fa974f24feb044d51f84f8332e2af0af04fbdbdd5bbbfb9cbbe354190409bc8307c83a9e38c6672c3c8855f709afb0006a009ea + languageName: node + linkType: hard + "pako@npm:~1.0.5": version: 1.0.11 resolution: "pako@npm:1.0.11" @@ -10874,16 +10910,6 @@ __metadata: languageName: node linkType: hard -"path-scurry@npm:^1.10.2": - version: 1.10.2 - resolution: "path-scurry@npm:1.10.2" - dependencies: - lru-cache: ^10.2.0 - minipass: ^5.0.0 || ^6.0.2 || ^7.0.0 - checksum: 6739b4290f7d1a949c61c758b481c07ac7d1a841964c68cf5e1fa153d7e18cbde4872b37aadf9c5173c800d627f219c47945859159de36c977dd82419997b9b8 - languageName: node - linkType: hard - "path-scurry@npm:^1.11.1": version: 1.11.1 resolution: "path-scurry@npm:1.11.1" @@ -10923,10 +10949,10 @@ __metadata: languageName: node linkType: hard -"picocolors@npm:^1.0.0": - version: 1.0.0 - resolution: "picocolors@npm:1.0.0" - checksum: a2e8092dd86c8396bdba9f2b5481032848525b3dc295ce9b57896f931e63fc16f79805144321f72976383fc249584672a75cc18d6777c6b757603f372f745981 +"picocolors@npm:^1.0.0, picocolors@npm:^1.0.1": + version: 1.0.1 + resolution: "picocolors@npm:1.0.1" + checksum: fa68166d1f56009fc02a34cdfd112b0dd3cf1ef57667ac57281f714065558c01828cdf4f18600ad6851cbe0093952ed0660b1e0156bddf2184b6aaf5817553a5 languageName: node linkType: hard @@ -10979,9 +11005,9 @@ __metadata: linkType: hard "pony-cause@npm:^2.1.10, pony-cause@npm:^2.1.9": - version: 2.1.10 - resolution: "pony-cause@npm:2.1.10" - checksum: 8b61378f213e61056312dc274a1c79980154e9d864f6ad86e0c8b91a50d3ce900d430995ee24147c9f3caa440dfe7d51c274b488d7f033b65b206522536d7217 + version: 2.1.11 + resolution: "pony-cause@npm:2.1.11" + checksum: 4aaa9ddab8f8225b5cbb32f7329a71b73679074579fa91f9e9d6853d398f3c2872de979519e1525c0c91d53afc82c32fddb76e379d19157e69ef1f7064523dfa languageName: node linkType: hard @@ -11010,7 +11036,7 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.35": +"postcss@npm:^8.4.38": version: 8.4.38 resolution: "postcss@npm:8.4.38" dependencies: @@ -11090,6 +11116,13 @@ __metadata: languageName: node linkType: hard +"proc-log@npm:^4.0.0, proc-log@npm:^4.2.0": + version: 4.2.0 + resolution: "proc-log@npm:4.2.0" + checksum: 98f6cd012d54b5334144c5255ecb941ee171744f45fca8b43b58ae5a0c1af07352475f481cadd9848e7f0250376ee584f6aa0951a856ff8f021bdfbff4eb33fc + languageName: node + linkType: hard + "process@npm:^0.11.10": version: 0.11.10 resolution: "process@npm:0.11.10" @@ -11236,9 +11269,9 @@ __metadata: linkType: hard "react-is@npm:^18.0.0": - version: 18.2.0 - resolution: "react-is@npm:18.2.0" - checksum: e72d0ba81b5922759e4aff17e0252bd29988f9642ed817f56b25a3e217e13eea8a7f2322af99a06edb779da12d5d636e9fda473d620df9a3da0df2a74141d53e + version: 18.3.1 + resolution: "react-is@npm:18.3.1" + checksum: e20fe84c86ff172fc8d898251b7cc2c43645d108bf96d0b8edf39b98f9a2cae97b40520ee7ed8ee0085ccc94736c4886294456033304151c3f94978cec03df21 languageName: node linkType: hard @@ -11436,9 +11469,9 @@ __metadata: linkType: hard "rfdc@npm:^1.3.0": - version: 1.3.1 - resolution: "rfdc@npm:1.3.1" - checksum: d5d1e930aeac7e0e0a485f97db1356e388bdbeff34906d206fe524dd5ada76e95f186944d2e68307183fdc39a54928d4426bbb6734851692cfe9195efba58b79 + version: 1.4.1 + resolution: "rfdc@npm:1.4.1" + checksum: 3b05bd55062c1d78aaabfcea43840cdf7e12099968f368e9a4c3936beb744adb41cbdb315eac6d4d8c6623005d6f87fdf16d8a10e1ff3722e84afea7281c8d13 languageName: node linkType: hard @@ -11495,25 +11528,25 @@ __metadata: linkType: hard "rollup@npm:^4.0.2": - version: 4.16.4 - resolution: "rollup@npm:4.16.4" - dependencies: - "@rollup/rollup-android-arm-eabi": 4.16.4 - "@rollup/rollup-android-arm64": 4.16.4 - "@rollup/rollup-darwin-arm64": 4.16.4 - "@rollup/rollup-darwin-x64": 4.16.4 - "@rollup/rollup-linux-arm-gnueabihf": 4.16.4 - "@rollup/rollup-linux-arm-musleabihf": 4.16.4 - "@rollup/rollup-linux-arm64-gnu": 4.16.4 - "@rollup/rollup-linux-arm64-musl": 4.16.4 - "@rollup/rollup-linux-powerpc64le-gnu": 4.16.4 - "@rollup/rollup-linux-riscv64-gnu": 4.16.4 - "@rollup/rollup-linux-s390x-gnu": 4.16.4 - "@rollup/rollup-linux-x64-gnu": 4.16.4 - "@rollup/rollup-linux-x64-musl": 4.16.4 - "@rollup/rollup-win32-arm64-msvc": 4.16.4 - "@rollup/rollup-win32-ia32-msvc": 4.16.4 - "@rollup/rollup-win32-x64-msvc": 4.16.4 + version: 4.18.0 + resolution: "rollup@npm:4.18.0" + dependencies: + "@rollup/rollup-android-arm-eabi": 4.18.0 + "@rollup/rollup-android-arm64": 4.18.0 + "@rollup/rollup-darwin-arm64": 4.18.0 + "@rollup/rollup-darwin-x64": 4.18.0 + "@rollup/rollup-linux-arm-gnueabihf": 4.18.0 + "@rollup/rollup-linux-arm-musleabihf": 4.18.0 + "@rollup/rollup-linux-arm64-gnu": 4.18.0 + "@rollup/rollup-linux-arm64-musl": 4.18.0 + "@rollup/rollup-linux-powerpc64le-gnu": 4.18.0 + "@rollup/rollup-linux-riscv64-gnu": 4.18.0 + "@rollup/rollup-linux-s390x-gnu": 4.18.0 + "@rollup/rollup-linux-x64-gnu": 4.18.0 + "@rollup/rollup-linux-x64-musl": 4.18.0 + "@rollup/rollup-win32-arm64-msvc": 4.18.0 + "@rollup/rollup-win32-ia32-msvc": 4.18.0 + "@rollup/rollup-win32-x64-msvc": 4.18.0 "@types/estree": 1.0.5 fsevents: ~2.3.2 dependenciesMeta: @@ -11553,7 +11586,7 @@ __metadata: optional: true bin: rollup: dist/bin/rollup - checksum: fe19998a00401e7c2a41171e7d42af549176c6abfb6b20c4d0f401c973a3c7ad368605a722194bb21fe32775563eac06b53c9d96b24ef3d0ac95f69c5a3b67c8 + checksum: 54cde921e763017ce952ba76ec77d58dd9c01e3536c3be628d4af8c59d9b2f0e1e6a11b30fda44845c7b74098646cd972feb3bcd2f4a35d3293366f2eeb0a39e languageName: node linkType: hard @@ -11660,13 +11693,11 @@ __metadata: linkType: hard "semver@npm:7.x, semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0": - version: 7.6.0 - resolution: "semver@npm:7.6.0" - dependencies: - lru-cache: ^6.0.0 + version: 7.6.2 + resolution: "semver@npm:7.6.2" bin: semver: bin/semver.js - checksum: 7427f05b70786c696640edc29fdd4bc33b2acf3bbe1740b955029044f80575fc664e1a512e4113c3af21e767154a94b4aa214bf6cd6e42a1f6dba5914e0b208c + checksum: 40f6a95101e8d854357a644da1b8dd9d93ce786d5c6a77227bc69dbb17bea83d0d1d1d7c4cd5920a6df909f48e8bd8a5909869535007f90278289f2451d0292d languageName: node linkType: hard @@ -11680,11 +11711,11 @@ __metadata: linkType: hard "ses@npm:^1.1.0": - version: 1.4.1 - resolution: "ses@npm:1.4.1" + version: 1.5.0 + resolution: "ses@npm:1.5.0" dependencies: - "@endo/env-options": ^1.1.3 - checksum: 1eb601edec1133fb225c146715d1a1f281b6fbd14ce74bf2783ff43bdfc59ede8ac5c82d7533f5a73dff1bbb2ccf5d29e1d087c4892d6011255f57dcc7da352c + "@endo/env-options": ^1.1.4 + checksum: feaf07c285ab44645532fde8d679ba458fcb040512341d817c053c5b44c37d61f664c60a7b0fc8c1f0b999520888746010d89f718e1a154856ab93d1eea45b31 languageName: node linkType: hard @@ -11923,7 +11954,7 @@ __metadata: languageName: node linkType: hard -"source-map-js@npm:^1.0.2, source-map-js@npm:^1.2.0": +"source-map-js@npm:^1.2.0": version: 1.2.0 resolution: "source-map-js@npm:1.2.0" checksum: 791a43306d9223792e84293b00458bf102a8946e7188f3db0e4e22d8d530b5f80a4ce468eb5ec0bf585443ad55ebbd630bf379c98db0b1f317fd902500217f97 @@ -11991,9 +12022,9 @@ __metadata: linkType: hard "spdx-license-ids@npm:^3.0.0": - version: 3.0.17 - resolution: "spdx-license-ids@npm:3.0.17" - checksum: 0aba5d16292ff604dd20982200e23b4d425f6ba364765039bdbde2f6c956b9909fce1ad040a897916a5f87388e85e001f90cb64bf706b6e319f3908cfc445a59 + version: 3.0.18 + resolution: "spdx-license-ids@npm:3.0.18" + checksum: 457825df5dd1fc0135b0bb848c896143f70945cc2da148afc71c73ed0837d1d651f809006e406d82109c9dd71a8cb39785a3604815fe46bc0548e9d3976f6b69 languageName: node linkType: hard @@ -12012,11 +12043,11 @@ __metadata: linkType: hard "ssri@npm:^10.0.0": - version: 10.0.5 - resolution: "ssri@npm:10.0.5" + version: 10.0.6 + resolution: "ssri@npm:10.0.6" dependencies: minipass: ^7.0.3 - checksum: 0a31b65f21872dea1ed3f7c200d7bc1c1b91c15e419deca14f282508ba917cbb342c08a6814c7f68ca4ca4116dd1a85da2bbf39227480e50125a1ceffeecb750 + checksum: 4603d53a05bcd44188747d38f1cc43833b9951b5a1ee43ba50535bdfc5fe4a0897472dbe69837570a5417c3c073377ef4f8c1a272683b401857f72738ee57299 languageName: node linkType: hard @@ -12039,16 +12070,17 @@ __metadata: linkType: hard "streamx@npm:^2.15.0": - version: 2.16.1 - resolution: "streamx@npm:2.16.1" + version: 2.18.0 + resolution: "streamx@npm:2.18.0" dependencies: bare-events: ^2.2.0 - fast-fifo: ^1.1.0 + fast-fifo: ^1.3.2 queue-tick: ^1.0.1 + text-decoder: ^1.1.0 dependenciesMeta: bare-events: optional: true - checksum: 6bbb4c38c0ab6ddbe0857d55e72f71288f308f2a9f4413b7b07391cdf9f94232ffc2bbe40a1212d2e09634ecdbd5052b444c73cc8d67ae1c97e2b7e553dad559 + checksum: 88193eb37ad194e18cf62a7d6392180a0565017d494e2c96ee09f1e7ff64c16cdf97059e39cab4b16972e812d08d744d1e3c5117f4213e8057c44ad3963f2461 languageName: node linkType: hard @@ -12214,17 +12246,10 @@ __metadata: languageName: node linkType: hard -"superstruct@npm:1.0.3": - version: 1.0.3 - resolution: "superstruct@npm:1.0.3" - checksum: 761790bb111e6e21ddd608299c252f3be35df543263a7ebbc004e840d01fcf8046794c274bcb351bdf3eae4600f79d317d085cdbb19ca05803a4361840cc9bb1 - languageName: node - linkType: hard - -"superstruct@npm:^1.0.3": - version: 1.0.4 - resolution: "superstruct@npm:1.0.4" - checksum: 2e070994cc4998a753c3f0215449d6de01ffb8180e4f46527f559ffbc2ebcc40fcf428f545ccd355921ef2920db7d138a96258ae35c788e6c24b2aa8bb1695cb +"superstruct@github:MetaMask/superstruct#v3.1.0": + version: 3.1.0 + resolution: "superstruct@https://github.com/MetaMask/superstruct.git#commit=3cd308f6607bc52e2fa0582f4a778f9ed597e25c" + checksum: 85e7fd4c9046a5cf6fa990d6497f26a7e20493d25143f80269e7c950636679f0604e2ea5f0bcbea78c7351072905ba8998ff2f2ba8e6c4750852fbc58ed82247 languageName: node linkType: hard @@ -12358,6 +12383,15 @@ __metadata: languageName: node linkType: hard +"text-decoder@npm:^1.1.0": + version: 1.1.0 + resolution: "text-decoder@npm:1.1.0" + dependencies: + b4a: ^1.6.4 + checksum: 450056ddac3cd56a47d1d3093af651f446981721f893e28fafeb2563b3270bcd5c879ecac263297569f894f63f03f4ec3b32ac9aa884febffe05604e119d50c6 + languageName: node + linkType: hard + "text-table@npm:^0.2.0": version: 0.2.0 resolution: "text-table@npm:0.2.0" @@ -12414,14 +12448,14 @@ __metadata: linkType: hard "tough-cookie@npm:^4.0.0": - version: 4.1.3 - resolution: "tough-cookie@npm:4.1.3" + version: 4.1.4 + resolution: "tough-cookie@npm:4.1.4" dependencies: psl: ^1.1.33 punycode: ^2.1.1 universalify: ^0.2.0 url-parse: ^1.5.3 - checksum: c9226afff36492a52118432611af083d1d8493a53ff41ec4ea48e5b583aec744b989e4280bcf476c910ec1525a89a4a0f1cae81c08b18fb2ec3a9b3a72b91dcc + checksum: 5815059f014c31179a303c673f753f7899a6fce94ac93712c88ea5f3c26e0c042b5f0c7a599a00f8e0feeca4615dba75c3dffc54f3c1a489978aa8205e09307c languageName: node linkType: hard @@ -12659,13 +12693,6 @@ __metadata: languageName: node linkType: hard -"tweetnacl-util@npm:^0.15.1": - version: 0.15.1 - resolution: "tweetnacl-util@npm:0.15.1" - checksum: ae6aa8a52cdd21a95103a4cc10657d6a2040b36c7a6da7b9d3ab811c6750a2d5db77e8c36969e75fdee11f511aa2b91c552496c6e8e989b6e490e54aca2864fc - languageName: node - linkType: hard - "tweetnacl@npm:^1.0.3": version: 1.0.3 resolution: "tweetnacl@npm:1.0.3" @@ -12718,9 +12745,9 @@ __metadata: linkType: hard "type-fest@npm:^4.0.0": - version: 4.20.0 - resolution: "type-fest@npm:4.20.0" - checksum: 7eba1a5addf6c378328ba7adc6c8c6155f43a0d49dd8fd4e19a595f6a4832fdade7e5c99d763c60952e2ca649d03a02a3b94c517d45dfdd412041d35a721afac + version: 4.20.1 + resolution: "type-fest@npm:4.20.1" + checksum: 8cc8d86c900be4a803a4b252840b761153541f18b03c5bcc02fa2684d0237d48895cc675cd234049f110004d9ce63770242255c04890b85a133f72643c49e342 languageName: node linkType: hard @@ -12793,11 +12820,11 @@ __metadata: linkType: hard "typedoc-plugin-missing-exports@npm:^2.0.0": - version: 2.2.0 - resolution: "typedoc-plugin-missing-exports@npm:2.2.0" + version: 2.3.0 + resolution: "typedoc-plugin-missing-exports@npm:2.3.0" peerDependencies: typedoc: 0.24.x || 0.25.x - checksum: d210287864e3ab5c5973d864165c870b5b62c8b6ad1ff5053d604076449111dd751cfb68e5ba10c71594295c64372e6c8021e88ad5921c810e771a60ee8ee22f + checksum: 6d261161180b979e11d337117f975804f213831005219b18877b48fa702692bec20849f1e0066448c6dd87c1107bc4cd18152a834169211c0dc919e59cc0ef4b languageName: node linkType: hard @@ -12910,17 +12937,17 @@ __metadata: languageName: node linkType: hard -"update-browserslist-db@npm:^1.0.13": - version: 1.0.13 - resolution: "update-browserslist-db@npm:1.0.13" +"update-browserslist-db@npm:^1.0.16": + version: 1.0.16 + resolution: "update-browserslist-db@npm:1.0.16" dependencies: - escalade: ^3.1.1 - picocolors: ^1.0.0 + escalade: ^3.1.2 + picocolors: ^1.0.1 peerDependencies: browserslist: ">= 4.21.0" bin: update-browserslist-db: cli.js - checksum: 1e47d80182ab6e4ad35396ad8b61008ae2a1330221175d0abd37689658bdb61af9b705bfc41057fd16682474d79944fb2d86767c5ed5ae34b6276b9bed353322 + checksum: 51b1f7189c9ea5925c80154b0a6fd3ec36106d07858d8f69826427d8edb4735d1801512c69eade38ba0814d7407d11f400d74440bbf3da0309f3d788017f35b2 languageName: node linkType: hard @@ -13024,11 +13051,9 @@ __metadata: linkType: hard "validate-npm-package-name@npm:^5.0.0": - version: 5.0.0 - resolution: "validate-npm-package-name@npm:5.0.0" - dependencies: - builtins: ^5.0.0 - checksum: 5342a994986199b3c28e53a8452a14b2bb5085727691ea7aa0d284a6606b127c371e0925ae99b3f1ef7cc7d2c9de75f52eb61a3d1cc45e39bca1e3a9444cbb4e + version: 5.0.1 + resolution: "validate-npm-package-name@npm:5.0.1" + checksum: 0d583a1af23aeffea7748742cf22b6802458736fb8b60323ba5949763824d46f796474b0e1b9206beb716f9d75269e19dbd7795d6b038b29d561be95dd827381 languageName: node linkType: hard @@ -13092,6 +13117,13 @@ __metadata: linkType: hard "webextension-polyfill@npm:>=0.10.0 <1.0": + version: 0.12.0 + resolution: "webextension-polyfill@npm:0.12.0" + checksum: fc2166c8c9d3f32d7742727394092ff1a1eb19cbc4e5a73066d57f9bff1684e38342b90fabd23981e7295e904c536e8509552a64e989d217dae5de6ddca73532 + languageName: node + linkType: hard + +"webextension-polyfill@npm:^0.10.0": version: 0.10.0 resolution: "webextension-polyfill@npm:0.10.0" checksum: 4a59036bda571360c2c0b2fb03fe1dc244f233946bcf9a6766f677956c40fd14d270aaa69cdba95e4ac521014afbe4008bfa5959d0ac39f91c990eb206587f91 @@ -13285,6 +13317,13 @@ __metadata: languageName: node linkType: hard +"word-wrap@npm:^1.2.5": + version: 1.2.5 + resolution: "word-wrap@npm:1.2.5" + checksum: f93ba3586fc181f94afdaff3a6fef27920b4b6d9eaefed0f428f8e07adea2a7f54a5f2830ce59406c8416f033f86902b91eb824072354645eea687dff3691ccb + languageName: node + linkType: hard + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -13351,24 +13390,24 @@ __metadata: languageName: node linkType: hard -"ws@npm:8.5.0": - version: 8.5.0 - resolution: "ws@npm:8.5.0" +"ws@npm:8.17.1": + version: 8.17.1 + resolution: "ws@npm:8.17.1" peerDependencies: bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 + utf-8-validate: ">=5.0.2" peerDependenciesMeta: bufferutil: optional: true utf-8-validate: optional: true - checksum: 76f2f90e40344bf18fd544194e7067812fb1372b2a37865678d8f12afe4b478ff2ebc0c7c0aff82cd5e6b66fc43d889eec0f1865c2365d8f7a66d92da7744a77 + checksum: 442badcce1f1178ec87a0b5372ae2e9771e07c4929a3180321901f226127f252441e8689d765aa5cfba5f50ac60dd830954afc5aeae81609aefa11d3ddf5cecf languageName: node linkType: hard "ws@npm:^7.4.6": - version: 7.5.9 - resolution: "ws@npm:7.5.9" + version: 7.5.10 + resolution: "ws@npm:7.5.10" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ^5.0.2 @@ -13377,7 +13416,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: c3c100a181b731f40b7f2fddf004aa023f79d64f489706a28bc23ff88e87f6a64b3c6651fbec3a84a53960b75159574d7a7385709847a62ddb7ad6af76f49138 + checksum: f9bb062abf54cc8f02d94ca86dcd349c3945d63851f5d07a3a61c2fcb755b15a88e943a63cf580cbdb5b74436d67ef6b67f745b8f7c0814e411379138e1863cb languageName: node linkType: hard @@ -13438,11 +13477,11 @@ __metadata: linkType: hard "yaml@npm:^2.2.2, yaml@npm:^2.3.4": - version: 2.4.1 - resolution: "yaml@npm:2.4.1" + version: 2.4.5 + resolution: "yaml@npm:2.4.5" bin: yaml: bin.mjs - checksum: 4c391d07a5d5e935e058babb71026c9cdc9a6fd889e35dd91b53cfb0a12691b67c6c5c740858e71345fef18cd9c13c554a6dda9196f59820d769d94041badb0b + checksum: f8efd407c07e095f00f3031108c9960b2b12971d10162b1ec19007200f6c987d2e28f73283f4731119aa610f177a3ea03d4a8fcf640600a25de1b74d00c69b3d languageName: node linkType: hard From 6e73a352dccef39f4f5a2ab95118216ac433b7af Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:57:08 -0400 Subject: [PATCH 05/47] Linter fixes --- package.json | 6 +++--- packages/assets-controllers/src/NftController.test.ts | 11 ++++++----- .../src/TokenDetectionController.test.ts | 5 +++-- packages/network-controller/src/index.ts | 6 +++++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 6a617659e6..ec8786bef2 100644 --- a/package.json +++ b/package.json @@ -45,12 +45,12 @@ "resolutions": { "@metamask/keyring-api@^6.0.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", "@metamask/keyring-api@^6.1.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", - "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", - "@metamask/snaps-sdk@^4.2.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", + "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", - "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", + "@metamask/snaps-sdk@^4.2.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-utils@^7.0.3": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", + "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/snaps-utils@^7.3.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/utils": "8.5.0", "superstruct": "github:MetaMask/superstruct#v3.1.0", diff --git a/packages/assets-controllers/src/NftController.test.ts b/packages/assets-controllers/src/NftController.test.ts index d39a7d3a4f..2eee6e2608 100644 --- a/packages/assets-controllers/src/NftController.test.ts +++ b/packages/assets-controllers/src/NftController.test.ts @@ -311,11 +311,12 @@ describe('NftController', () => { }, ], }); - const DEPRESSIONIST_CLOUDFLARE_IPFS_SUBDOMAIN_PATH = await getFormattedIpfsUrl( - IPFS_DEFAULT_GATEWAY_URL, - `ipfs://${DEPRESSIONIST_CID_V1}`, - true, - ); + const DEPRESSIONIST_CLOUDFLARE_IPFS_SUBDOMAIN_PATH = + await getFormattedIpfsUrl( + IPFS_DEFAULT_GATEWAY_URL, + `ipfs://${DEPRESSIONIST_CID_V1}`, + true, + ); nock(DEPRESSIONIST_CLOUDFLARE_IPFS_SUBDOMAIN_PATH).get('/').reply(200, { name: 'name', image: 'image', diff --git a/packages/assets-controllers/src/TokenDetectionController.test.ts b/packages/assets-controllers/src/TokenDetectionController.test.ts index 58e1f9fd81..1ad1e569bf 100644 --- a/packages/assets-controllers/src/TokenDetectionController.test.ts +++ b/packages/assets-controllers/src/TokenDetectionController.test.ts @@ -8,14 +8,15 @@ import { } from '@metamask/controller-utils'; import type { InternalAccount } from '@metamask/keyring-api'; import type { KeyringControllerState } from '@metamask/keyring-controller'; +import { defaultState as defaultNetworkState } from '@metamask/network-controller'; import type { NetworkState, NetworkConfiguration, NetworkController, NetworkClientId, + AutoManagedNetworkClient, + CustomNetworkClientConfiguration, } from '@metamask/network-controller'; -import { defaultState as defaultNetworkState } from '@metamask/network-controller'; -import type { AutoManagedNetworkClient, CustomNetworkClientConfiguration } from '@metamask/network-controller'; import { getDefaultPreferencesState, type PreferencesState, diff --git a/packages/network-controller/src/index.ts b/packages/network-controller/src/index.ts index 240593dfb4..30611b9209 100644 --- a/packages/network-controller/src/index.ts +++ b/packages/network-controller/src/index.ts @@ -2,6 +2,10 @@ export type { AutoManagedNetworkClient } from './create-auto-managed-network-cli export * from './NetworkController'; export * from './constants'; export type { BlockTracker, Provider } from './types'; -export type { NetworkClientConfiguration, InfuraNetworkClientConfiguration, CustomNetworkClientConfiguration } from './types'; +export type { + NetworkClientConfiguration, + InfuraNetworkClientConfiguration, + CustomNetworkClientConfiguration, +} from './types'; export { NetworkClientType } from './types'; export type { NetworkClient } from './create-network-client'; From cad9be5d7d87094c791bcd8f066173ad099ee51e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 31 May 2024 16:24:37 -0400 Subject: [PATCH 06/47] Bump TypeScript to `~5.0.4` in remaining packages --- packages/chain-controller/package.json | 2 +- packages/profile-sync-controller/package.json | 2 +- scripts/create-package/package-template/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index cebebef3c7..151c899dfc 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -59,7 +59,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 64073bc0ed..8ed12dfbc3 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -63,7 +63,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/snaps-controllers": "^8.1.1" diff --git a/scripts/create-package/package-template/package.json b/scripts/create-package/package-template/package.json index f5f686a2c8..c3dd081092 100644 --- a/scripts/create-package/package-template/package.json +++ b/scripts/create-package/package-template/package.json @@ -47,7 +47,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "engines": { "node": "NODE_VERSIONS" From a014d03e290f444920e4633e2b3c50af2092001c Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:58:12 -0400 Subject: [PATCH 07/47] Fix missing yarn patch for `@metamask/keyring-api@^6.1.1` --- package.json | 1 + yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ec8786bef2..ec9aa5b45d 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "resolutions": { "@metamask/keyring-api@^6.0.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", "@metamask/keyring-api@^6.1.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", + "@metamask/keyring-api@^6.1.1": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", diff --git a/yarn.lock b/yarn.lock index c2f3b12301..25749737fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2473,7 +2473,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 languageName: unknown linkType: soft @@ -3490,7 +3490,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 peerDependencies: "@metamask/snaps-controllers": ^8.1.1 languageName: unknown From 1d8944a758df6b8115ae5ceea19007eab6815463 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 31 May 2024 16:26:40 -0400 Subject: [PATCH 08/47] Replace `multiformats` import with dynamic import, and convert methods to async --- .../assets-controllers/src/assetsUtil.test.ts | 36 +++++++++---------- packages/assets-controllers/src/assetsUtil.ts | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/assets-controllers/src/assetsUtil.test.ts b/packages/assets-controllers/src/assetsUtil.test.ts index 26b8af1619..dde909de1b 100644 --- a/packages/assets-controllers/src/assetsUtil.test.ts +++ b/packages/assets-controllers/src/assetsUtil.test.ts @@ -256,33 +256,33 @@ describe('assetsUtil', () => { }); describe('getIpfsCIDv1AndPath', () => { - it('should return content identifier from default ipfs url format', () => { + it('should return content identifier from default ipfs url format', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V0}`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: undefined }); }); - it('should return content identifier from alternative ipfs url format', () => { + it('should return content identifier from alternative ipfs url format', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${ALTERNATIVE_IPFS_URL_FORMAT}${IPFS_CID_V0}`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: undefined }); }); - it('should return unchanged content identifier if already v1', () => { + it('should return unchanged content identifier if already v1', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: undefined }); }); - it('should return a path when url contains one', () => { + it('should return a path when url contains one', async () => { expect( - assetsUtil.getIpfsCIDv1AndPath( + await assetsUtil.getIpfsCIDv1AndPath( `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test/test/test`, ), ).toStrictEqual({ cid: IPFS_CID_V1, path: '/test/test/test' }); @@ -290,9 +290,9 @@ describe('assetsUtil', () => { }); describe('getFormattedIpfsUrl', () => { - it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway without protocol prefix, no path and subdomainSupported argument set to true', () => { + it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway without protocol prefix, no path and subdomainSupported argument set to true', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( IFPS_GATEWAY, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}`, true, @@ -300,9 +300,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IPFS_CID_V1}.ipfs.${IFPS_GATEWAY}`); }); - it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a cidv0 and no path and subdomainSupported argument set to true', () => { + it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a cidv0 and no path and subdomainSupported argument set to true', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V0}`, true, @@ -310,9 +310,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IPFS_CID_V1}.ipfs.${IFPS_GATEWAY}`); }); - it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a path at the end of the url, and subdomainSupported argument set to true', () => { + it('should return a correctly formatted subdomained ipfs url when passed ipfsGateway with protocol prefix, a path at the end of the url, and subdomainSupported argument set to true', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test`, true, @@ -320,9 +320,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IPFS_CID_V1}.ipfs.${IFPS_GATEWAY}/test`); }); - it('should return a correctly formatted non-subdomained ipfs url when passed ipfsGateway with no "/ipfs/" appended, a path at the end of the url, and subdomainSupported argument set to false', () => { + it('should return a correctly formatted non-subdomained ipfs url when passed ipfsGateway with no "/ipfs/" appended, a path at the end of the url, and subdomainSupported argument set to false', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test`, false, @@ -330,9 +330,9 @@ describe('assetsUtil', () => { ).toBe(`https://${IFPS_GATEWAY}/ipfs/${IPFS_CID_V1}/test`); }); - it('should return a correctly formatted non-subdomained ipfs url when passed an ipfsGateway with "/ipfs/" appended, a path at the end of the url, subdomainSupported argument set to false', () => { + it('should return a correctly formatted non-subdomained ipfs url when passed an ipfsGateway with "/ipfs/" appended, a path at the end of the url, subdomainSupported argument set to false', async () => { expect( - assetsUtil.getFormattedIpfsUrl( + await assetsUtil.getFormattedIpfsUrl( `https://${IFPS_GATEWAY}/ipfs/`, `${DEFAULT_IPFS_URL_FORMAT}${IPFS_CID_V1}/test`, false, diff --git a/packages/assets-controllers/src/assetsUtil.ts b/packages/assets-controllers/src/assetsUtil.ts index 3f47f9b190..88cf625aae 100644 --- a/packages/assets-controllers/src/assetsUtil.ts +++ b/packages/assets-controllers/src/assetsUtil.ts @@ -228,7 +228,7 @@ export async function getIpfsCIDv1AndPath(ipfsUrl: string): Promise<{ const cid = index !== -1 ? url.substring(0, index) : url; const path = index !== -1 ? url.substring(index) : undefined; - const { CID } = await import('multiformats/cid'); + const { CID } = await import('multiformats'); // We want to ensure that the CID is v1 (https://docs.ipfs.io/concepts/content-addressing/#identifier-formats) // because most cid v0s appear to be incompatible with IPFS subdomains return { From c509fb47989ad126d8c9258ec643e7bb52b1ccc1 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 31 May 2024 16:27:31 -0400 Subject: [PATCH 09/47] Apply `--experimental-vm-modules` flag to jest test scripts to enable support for dynamic imports --- packages/assets-controllers/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index b64fbd586f..c025bebb5d 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controllers", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/assets-controllers", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethereumjs/util": "^8.1.0", From 94ddd59c2c982bdd156a8577cffe716677b7602c Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:13:47 -0400 Subject: [PATCH 10/47] Update yarn constraints to apply `--experimental-vm-modules` flag to test scripts in all packages --- constraints.pro | 8 ++++---- packages/accounts-controller/package.json | 8 ++++---- packages/address-book-controller/package.json | 8 ++++---- packages/announcement-controller/package.json | 8 ++++---- packages/approval-controller/package.json | 8 ++++---- packages/base-controller/package.json | 8 ++++---- packages/build-utils/package.json | 8 ++++---- packages/chain-controller/package.json | 8 ++++---- packages/composable-controller/package.json | 8 ++++---- packages/controller-utils/package.json | 8 ++++---- packages/ens-controller/package.json | 8 ++++---- packages/eth-json-rpc-provider/package.json | 8 ++++---- packages/gas-fee-controller/package.json | 8 ++++---- packages/json-rpc-engine/package.json | 8 ++++---- packages/json-rpc-middleware-stream/package.json | 8 ++++---- packages/keyring-controller/package.json | 8 ++++---- packages/logging-controller/package.json | 8 ++++---- packages/message-manager/package.json | 8 ++++---- packages/name-controller/package.json | 8 ++++---- packages/network-controller/package.json | 8 ++++---- packages/notification-controller/package.json | 8 ++++---- packages/permission-controller/package.json | 8 ++++---- packages/permission-log-controller/package.json | 8 ++++---- packages/phishing-controller/package.json | 8 ++++---- packages/polling-controller/package.json | 8 ++++---- packages/preferences-controller/package.json | 8 ++++---- packages/profile-sync-controller/package.json | 8 ++++---- packages/queued-request-controller/package.json | 8 ++++---- packages/rate-limit-controller/package.json | 8 ++++---- packages/selected-network-controller/package.json | 8 ++++---- packages/signature-controller/package.json | 8 ++++---- packages/transaction-controller/package.json | 8 ++++---- packages/user-operation-controller/package.json | 8 ++++---- 33 files changed, 132 insertions(+), 132 deletions(-) diff --git a/constraints.pro b/constraints.pro index 84cc63f1b5..673b55374f 100644 --- a/constraints.pro +++ b/constraints.pro @@ -312,19 +312,19 @@ gen_enforced_field(WorkspaceCwd, 'scripts.changelog:update', CorrectChangelogUpd \+ atom_concat(ExpectedPrefix, _, ChangelogUpdateCommand). % All non-root packages must have the same "test" script. -gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter') :- +gen_enforced_field(WorkspaceCwd, 'scripts.test', 'NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter') :- WorkspaceCwd \= '.'. % All non-root packages must have the same "test:clean" script. -gen_enforced_field(WorkspaceCwd, 'scripts.test:clean', 'jest --clearCache') :- +gen_enforced_field(WorkspaceCwd, 'scripts.test:clean', 'NODE_OPTIONS=--experimental-vm-modules jest --clearCache') :- WorkspaceCwd \= '.'. % All non-root packages must have the same "test:verbose" script. -gen_enforced_field(WorkspaceCwd, 'scripts.test:verbose', 'jest --verbose') :- +gen_enforced_field(WorkspaceCwd, 'scripts.test:verbose', 'NODE_OPTIONS=--experimental-vm-modules jest --verbose') :- WorkspaceCwd \= '.'. % All non-root packages must have the same "test:watch" script. -gen_enforced_field(WorkspaceCwd, 'scripts.test:watch', 'jest --watch') :- +gen_enforced_field(WorkspaceCwd, 'scripts.test:watch', 'NODE_OPTIONS=--experimental-vm-modules jest --watch') :- WorkspaceCwd \= '.'. % All dependency ranges must be recognizable (this makes it possible to apply diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index e7d1a3d19d..08e92c48c9 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/accounts-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethereumjs/util": "^8.1.0", diff --git a/packages/address-book-controller/package.json b/packages/address-book-controller/package.json index da881c5e3d..378dd40d42 100644 --- a/packages/address-book-controller/package.json +++ b/packages/address-book-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/address-book-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/address-book-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/announcement-controller/package.json b/packages/announcement-controller/package.json index 4168b2af53..457fc71e51 100644 --- a/packages/announcement-controller/package.json +++ b/packages/announcement-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/announcement-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/announcement-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0" diff --git a/packages/approval-controller/package.json b/packages/approval-controller/package.json index 3675c18f06..ea0a0a792e 100644 --- a/packages/approval-controller/package.json +++ b/packages/approval-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/approval-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/approval-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/base-controller/package.json b/packages/base-controller/package.json index 650555bc58..dc7cc561e7 100644 --- a/packages/base-controller/package.json +++ b/packages/base-controller/package.json @@ -34,10 +34,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/base-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/base-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/utils": "^8.3.0", diff --git a/packages/build-utils/package.json b/packages/build-utils/package.json index 6e0489ff05..db094021ab 100644 --- a/packages/build-utils/package.json +++ b/packages/build-utils/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/build-utils", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/build-utils", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/utils": "^8.3.0", diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 151c899dfc..fffd530647 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/chain-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/chain-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/composable-controller/package.json b/packages/composable-controller/package.json index dc530c3510..887e0facfb 100644 --- a/packages/composable-controller/package.json +++ b/packages/composable-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/composable-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/composable-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0" diff --git a/packages/controller-utils/package.json b/packages/controller-utils/package.json index ac96d8c739..176bef5c90 100644 --- a/packages/controller-utils/package.json +++ b/packages/controller-utils/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/controller-utils", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/controller-utils", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethereumjs/util": "^8.1.0", diff --git a/packages/ens-controller/package.json b/packages/ens-controller/package.json index c193ef1a56..d2c531895b 100644 --- a/packages/ens-controller/package.json +++ b/packages/ens-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/ens-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/ens-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethersproject/providers": "^5.7.0", diff --git a/packages/eth-json-rpc-provider/package.json b/packages/eth-json-rpc-provider/package.json index 0f283cc453..65c6ed89c4 100644 --- a/packages/eth-json-rpc-provider/package.json +++ b/packages/eth-json-rpc-provider/package.json @@ -40,10 +40,10 @@ "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:dependencies", "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/json-rpc-engine": "^9.0.0", diff --git a/packages/gas-fee-controller/package.json b/packages/gas-fee-controller/package.json index 9852fe568a..3b1847390e 100644 --- a/packages/gas-fee-controller/package.json +++ b/packages/gas-fee-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/gas-fee-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/gas-fee-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/json-rpc-engine/package.json b/packages/json-rpc-engine/package.json index 618b50f414..953ea6d656 100644 --- a/packages/json-rpc-engine/package.json +++ b/packages/json-rpc-engine/package.json @@ -44,10 +44,10 @@ "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn lint:dependencies && yarn lint:changelog", "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/rpc-errors": "^6.2.1", diff --git a/packages/json-rpc-middleware-stream/package.json b/packages/json-rpc-middleware-stream/package.json index cb1a6871c3..9a8d06145e 100644 --- a/packages/json-rpc-middleware-stream/package.json +++ b/packages/json-rpc-middleware-stream/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/json-rpc-middleware-stream --tag-prefix-before-package-rename json-rpc-middleware-stream@ --version-before-package-rename 5.0.1", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/json-rpc-middleware-stream --tag-prefix-before-package-rename json-rpc-middleware-stream@ --version-before-package-rename 5.0.1", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/json-rpc-engine": "^9.0.0", diff --git a/packages/keyring-controller/package.json b/packages/keyring-controller/package.json index d7e64d789e..d52b56fbd6 100644 --- a/packages/keyring-controller/package.json +++ b/packages/keyring-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/keyring-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/keyring-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethereumjs/util": "^8.1.0", diff --git a/packages/logging-controller/package.json b/packages/logging-controller/package.json index 332b953c68..fe60c57d7d 100644 --- a/packages/logging-controller/package.json +++ b/packages/logging-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/logging-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/logging-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/message-manager/package.json b/packages/message-manager/package.json index 99929a2c4e..a33349b6d8 100644 --- a/packages/message-manager/package.json +++ b/packages/message-manager/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/message-manager", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/message-manager", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/name-controller/package.json b/packages/name-controller/package.json index 8408aaebca..97ff90f95a 100644 --- a/packages/name-controller/package.json +++ b/packages/name-controller/package.json @@ -36,10 +36,10 @@ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/name-controller", "prepare-manifest:preview": "../../scripts/prepare-preview-manifest.sh", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/network-controller/package.json b/packages/network-controller/package.json index 78b2ffc55b..dd0022c8c5 100644 --- a/packages/network-controller/package.json +++ b/packages/network-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/network-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/network-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json index b83fde2a44..fc5b6312f2 100644 --- a/packages/notification-controller/package.json +++ b/packages/notification-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/notification-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/notification-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/permission-controller/package.json b/packages/permission-controller/package.json index f9e1ca8c1c..81bd0482ee 100644 --- a/packages/permission-controller/package.json +++ b/packages/permission-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/permission-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/permission-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/permission-log-controller/package.json b/packages/permission-log-controller/package.json index 2042c983c8..23a7bdc541 100644 --- a/packages/permission-log-controller/package.json +++ b/packages/permission-log-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/permission-log-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/permission-log-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/phishing-controller/package.json b/packages/phishing-controller/package.json index ce6fe07c9c..9e621d0eb5 100644 --- a/packages/phishing-controller/package.json +++ b/packages/phishing-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/phishing-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/phishing-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/polling-controller/package.json b/packages/polling-controller/package.json index 257f361669..d316c74034 100644 --- a/packages/polling-controller/package.json +++ b/packages/polling-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/polling-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/polling-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/preferences-controller/package.json b/packages/preferences-controller/package.json index bf6effcdd0..60e00826b8 100644 --- a/packages/preferences-controller/package.json +++ b/packages/preferences-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/preferences-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/preferences-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 8ed12dfbc3..b423893edc 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/profile-sync-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/profile-sync-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/queued-request-controller/package.json b/packages/queued-request-controller/package.json index c41e6099b5..f3eea3053e 100644 --- a/packages/queued-request-controller/package.json +++ b/packages/queued-request-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/queued-request-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/queued-request-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/rate-limit-controller/package.json b/packages/rate-limit-controller/package.json index 4fc72c8f7a..4046c2ab70 100644 --- a/packages/rate-limit-controller/package.json +++ b/packages/rate-limit-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/rate-limit-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/rate-limit-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/selected-network-controller/package.json b/packages/selected-network-controller/package.json index 92bffa4948..d97c61fc16 100644 --- a/packages/selected-network-controller/package.json +++ b/packages/selected-network-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/selected-network-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/selected-network-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/base-controller": "^6.0.0", diff --git a/packages/signature-controller/package.json b/packages/signature-controller/package.json index 53be528e05..e64b5ef26c 100644 --- a/packages/signature-controller/package.json +++ b/packages/signature-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/signature-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/signature-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/approval-controller": "^7.0.0", diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index 76704af672..88a00fa61f 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/transaction-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/transaction-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@ethereumjs/common": "^3.2.0", diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index 19cf18664c..8ae8f6c339 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -36,10 +36,10 @@ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/user-operation-controller", "prepare-manifest:preview": "../../scripts/prepare-preview-manifest.sh", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@metamask/approval-controller": "^7.0.0", From c21f3f9082abb508d2d2eaf21a55055e27dfd887 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Sun, 2 Jun 2024 17:42:09 -0400 Subject: [PATCH 11/47] Remove `EthErc4337Method` enum usage due to upstream removal --- packages/accounts-controller/src/AccountsController.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/accounts-controller/src/AccountsController.test.ts b/packages/accounts-controller/src/AccountsController.test.ts index cf8a1b1a4d..dfeed4bfce 100644 --- a/packages/accounts-controller/src/AccountsController.test.ts +++ b/packages/accounts-controller/src/AccountsController.test.ts @@ -198,7 +198,7 @@ function createExpectedInternalAccount({ }; const methods = - accountTypeToMethods[type as unknown as keyof typeof accountTypeToMethods]; + accountTypeToMethods[type as keyof typeof accountTypeToMethods]; const account = { id, From 1b6fec9396f9ec049e9839ce71d8752754530949 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:14:42 -0400 Subject: [PATCH 12/47] Apply yarn patch to new `@metamask/keyring-api` version --- ...ask-keyring-api-npm-6.1.0-1b3da6f710.patch | 21 ------------------- ...ask-keyring-api-npm-6.4.0-3a5b2ed69f.patch | 21 +++++++++++++++++++ package.json | 5 ++--- 3 files changed, 23 insertions(+), 24 deletions(-) delete mode 100644 .yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch create mode 100644 .yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch diff --git a/.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch b/.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch deleted file mode 100644 index a8b5e7fbe7..0000000000 --- a/.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/dist/superstruct.d.ts b/dist/superstruct.d.ts -index b81329da445b729dc26533adb51443f14e58e5dc..2857b6d3d4c9070d7c557bd15f7c1b9bc41c9951 100644 ---- a/dist/superstruct.d.ts -+++ b/dist/superstruct.d.ts -@@ -1,6 +1,6 @@ - import type { Infer } from 'superstruct'; - import { Struct } from 'superstruct'; --import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct/dist/utils'; -+import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct'; - declare const ExactOptionalSymbol: unique symbol; - export declare type ExactOptionalTag = { - type: typeof ExactOptionalSymbol; -diff --git a/dist/superstruct.js.map b/dist/superstruct.js.map -index 746668d2b1959fedd9150a9faf35ea30e30b5a7a..aaf130b761f57ade6c49f009f1f5c825186e858a 100644 ---- a/dist/superstruct.js.map -+++ b/dist/superstruct.js.map -@@ -1 +1 @@ --{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAiE;AAkDjE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAAM,QAAQ,GAAW,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAA4B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE1E,OAAO,QAAQ,IAAI,MAAM,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,MAA4B;IAE5B,OAAO,IAAI,oBAAM,CAAC;QAChB,GAAG,MAAM;QAET,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;QAEnD,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACtB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAa,EAAE,GAAG,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC;AAZD,sCAYC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,IAAY,EACZ,OAAe;IAEf,OAAO,IAAA,oBAAM,EACX,IAAI,EACJ,CAAC,KAAc,EAAW,EAAE,CAC1B,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CACnD,CAAC;AACJ,CAAC;AATD,sCASC;AAED;;;;;GAKG;AACU,QAAA,SAAS,GAAG,IAAA,oBAAM,EAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,GAAG,CAAC;IAER,IAAI;QACF,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;KAChC;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IAED,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAC/D,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct/dist/utils';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define('Url', (value: unknown) => {\n let url;\n\n try {\n url = new URL(value as string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === 'http:' || url.protocol === 'https:';\n});\n"]} -\ No newline at end of file -+{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAiE;AAkDjE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG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C,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAC/D,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define('Url', (value: unknown) => {\n let url;\n\n try {\n url = new URL(value as string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === 'http:' || url.protocol === 'https:';\n});\n"]} -\ No newline at end of file diff --git a/.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch b/.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch new file mode 100644 index 0000000000..a39efbe336 --- /dev/null +++ b/.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch @@ -0,0 +1,21 @@ +diff --git a/dist/superstruct.d.ts b/dist/superstruct.d.ts +index 0297c3e9321713e6b84040e393bdc8a38c75f11b..4758932e7ddc007e36c48568726f278531dcaa07 100644 +--- a/dist/superstruct.d.ts ++++ b/dist/superstruct.d.ts +@@ -1,6 +1,6 @@ + import type { Infer } from 'superstruct'; + import { Struct } from 'superstruct'; +-import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct/dist/utils'; ++import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct'; + declare const ExactOptionalSymbol: unique symbol; + export declare type ExactOptionalTag = { + type: typeof ExactOptionalSymbol; +diff --git a/dist/superstruct.js.map b/dist/superstruct.js.map +index 13f57141d1dff4b920d3da3c2052ac54fa3f4590..aef7c243e6b37fc5a12a9ad71711ccab7922f3ec 100644 +--- a/dist/superstruct.js.map ++++ b/dist/superstruct.js.map +@@ -1 +1 @@ +-{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAyE;AAkDzE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAAM,QAAQ,GAAW,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAA4B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE1E,OAAO,QAAQ,IAAI,MAAM,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,MAA4B;IAE5B,OAAO,IAAI,oBAAM,CAAC;QAChB,GAAG,MAAM;QAET,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;QAEnD,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACtB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAa,EAAE,GAAG,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC;AAZD,sCAYC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,IAAY,EACZ,OAAe;IAEf,OAAO,IAAA,oBAAM,EACX,IAAI,EACJ,CAAC,KAAc,EAAW,EAAE,CAC1B,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CACnD,CAAC;AACJ,CAAC;AATD,sCASC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,UAAU,CACxB,KAAc,EACd,MAA4B,EAC5B,OAAgB;IAEhB,IAAA,oBAAM,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,gCAOC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, assert, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct/dist/utils';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Assert that a value is valid according to a struct.\n *\n * It is similar to superstruct's mask function, but it does not ignore extra\n * properties.\n *\n * @param value - Value to check.\n * @param struct - Struct to validate the value against.\n * @param message - Error message to throw if the value is not valid.\n * @returns The value if it is valid.\n */\nexport function strictMask(\n value: unknown,\n struct: Struct,\n message?: string,\n): Type {\n assert(value, struct, message);\n return value;\n}\n"]} +\ No newline at end of file ++{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAyE;AAkDzE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAAM,QAAQ,GAAW,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAA4B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE1E,OAAO,QAAQ,IAAI,MAAM,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,MAA4B;IAE5B,OAAO,IAAI,oBAAM,CAAC;QAChB,GAAG,MAAM;QAET,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;QAEnD,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACtB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAa,EAAE,GAAG,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC;AAZD,sCAYC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,IAAY,EACZ,OAAe;IAEf,OAAO,IAAA,oBAAM,EACX,IAAI,EACJ,CAAC,KAAc,EAAW,EAAE,CAC1B,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CACnD,CAAC;AACJ,CAAC;AATD,sCASC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,UAAU,CACxB,KAAc,EACd,MAA4B,EAC5B,OAAgB;IAEhB,IAAA,oBAAM,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,gCAOC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, assert, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Assert that a value is valid according to a struct.\n *\n * It is similar to superstruct's mask function, but it does not ignore extra\n * properties.\n *\n * @param value - Value to check.\n * @param struct - Struct to validate the value against.\n * @param message - Error message to throw if the value is not valid.\n * @returns The value if it is valid.\n */\nexport function strictMask(\n value: unknown,\n struct: Struct,\n message?: string,\n): Type {\n assert(value, struct, message);\n return value;\n}\n"]} +\ No newline at end of file diff --git a/package.json b/package.json index ec9aa5b45d..fb9ce45dfd 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,8 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/keyring-api@^6.0.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", - "@metamask/keyring-api@^6.1.0": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", - "@metamask/keyring-api@^6.1.1": "patch:@metamask/keyring-api@npm%3A6.1.0#./.yarn/patches/@metamask-keyring-api-npm-6.1.0-1b3da6f710.patch", + "@metamask/keyring-api@^6.3.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", + "@metamask/keyring-api@^6.1.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", From 8a5c556f4aae77371b776dff0fc50c3e89421754 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:15:22 -0400 Subject: [PATCH 13/47] Linter fixes --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fb9ce45dfd..ae11f5dac0 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/keyring-api@^6.3.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", "@metamask/keyring-api@^6.1.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", + "@metamask/keyring-api@^6.3.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", @@ -53,8 +53,7 @@ "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/snaps-utils@^7.3.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/utils": "8.5.0", - "superstruct": "github:MetaMask/superstruct#v3.1.0", - "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" + "superstruct": "github:MetaMask/superstruct#v3.1.0" }, "devDependencies": { "@babel/core": "^7.23.5", From 853340d53e7dc602369176b20dd2087a4298e765 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Sun, 2 Jun 2024 21:31:44 -0400 Subject: [PATCH 14/47] Linter fixes --- yarn.lock | 243 +++++++++++++++++++++++------------------------------- 1 file changed, 102 insertions(+), 141 deletions(-) diff --git a/yarn.lock b/yarn.lock index 25749737fe..a5cc9d13d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -603,163 +603,163 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/aix-ppc64@npm:0.19.12" +"@esbuild/aix-ppc64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/aix-ppc64@npm:0.21.5" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/android-arm64@npm:0.19.12" +"@esbuild/android-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-arm64@npm:0.21.5" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/android-arm@npm:0.19.12" +"@esbuild/android-arm@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-arm@npm:0.21.5" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/android-x64@npm:0.19.12" +"@esbuild/android-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-x64@npm:0.21.5" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/darwin-arm64@npm:0.19.12" +"@esbuild/darwin-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/darwin-arm64@npm:0.21.5" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/darwin-x64@npm:0.19.12" +"@esbuild/darwin-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/darwin-x64@npm:0.21.5" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/freebsd-arm64@npm:0.19.12" +"@esbuild/freebsd-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/freebsd-arm64@npm:0.21.5" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/freebsd-x64@npm:0.19.12" +"@esbuild/freebsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/freebsd-x64@npm:0.21.5" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-arm64@npm:0.19.12" +"@esbuild/linux-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-arm64@npm:0.21.5" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-arm@npm:0.19.12" +"@esbuild/linux-arm@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-arm@npm:0.21.5" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-ia32@npm:0.19.12" +"@esbuild/linux-ia32@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-ia32@npm:0.21.5" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-loong64@npm:0.19.12" +"@esbuild/linux-loong64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-loong64@npm:0.21.5" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-mips64el@npm:0.19.12" +"@esbuild/linux-mips64el@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-mips64el@npm:0.21.5" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-ppc64@npm:0.19.12" +"@esbuild/linux-ppc64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-ppc64@npm:0.21.5" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-riscv64@npm:0.19.12" +"@esbuild/linux-riscv64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-riscv64@npm:0.21.5" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-s390x@npm:0.19.12" +"@esbuild/linux-s390x@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-s390x@npm:0.21.5" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/linux-x64@npm:0.19.12" +"@esbuild/linux-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-x64@npm:0.21.5" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/netbsd-x64@npm:0.19.12" +"@esbuild/netbsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/netbsd-x64@npm:0.21.5" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/openbsd-x64@npm:0.19.12" +"@esbuild/openbsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/openbsd-x64@npm:0.21.5" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/sunos-x64@npm:0.19.12" +"@esbuild/sunos-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/sunos-x64@npm:0.21.5" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/win32-arm64@npm:0.19.12" +"@esbuild/win32-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-arm64@npm:0.21.5" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/win32-ia32@npm:0.19.12" +"@esbuild/win32-ia32@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-ia32@npm:0.21.5" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.19.12": - version: 0.19.12 - resolution: "@esbuild/win32-x64@npm:0.19.12" +"@esbuild/win32-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-x64@npm:0.21.5" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -6858,33 +6858,33 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.19.2": - version: 0.19.12 - resolution: "esbuild@npm:0.19.12" - dependencies: - "@esbuild/aix-ppc64": 0.19.12 - "@esbuild/android-arm": 0.19.12 - "@esbuild/android-arm64": 0.19.12 - "@esbuild/android-x64": 0.19.12 - "@esbuild/darwin-arm64": 0.19.12 - "@esbuild/darwin-x64": 0.19.12 - "@esbuild/freebsd-arm64": 0.19.12 - "@esbuild/freebsd-x64": 0.19.12 - "@esbuild/linux-arm": 0.19.12 - "@esbuild/linux-arm64": 0.19.12 - "@esbuild/linux-ia32": 0.19.12 - "@esbuild/linux-loong64": 0.19.12 - "@esbuild/linux-mips64el": 0.19.12 - "@esbuild/linux-ppc64": 0.19.12 - "@esbuild/linux-riscv64": 0.19.12 - "@esbuild/linux-s390x": 0.19.12 - "@esbuild/linux-x64": 0.19.12 - "@esbuild/netbsd-x64": 0.19.12 - "@esbuild/openbsd-x64": 0.19.12 - "@esbuild/sunos-x64": 0.19.12 - "@esbuild/win32-arm64": 0.19.12 - "@esbuild/win32-ia32": 0.19.12 - "@esbuild/win32-x64": 0.19.12 +"esbuild@npm:^0.21.4": + version: 0.21.5 + resolution: "esbuild@npm:0.21.5" + dependencies: + "@esbuild/aix-ppc64": 0.21.5 + "@esbuild/android-arm": 0.21.5 + "@esbuild/android-arm64": 0.21.5 + "@esbuild/android-x64": 0.21.5 + "@esbuild/darwin-arm64": 0.21.5 + "@esbuild/darwin-x64": 0.21.5 + "@esbuild/freebsd-arm64": 0.21.5 + "@esbuild/freebsd-x64": 0.21.5 + "@esbuild/linux-arm": 0.21.5 + "@esbuild/linux-arm64": 0.21.5 + "@esbuild/linux-ia32": 0.21.5 + "@esbuild/linux-loong64": 0.21.5 + "@esbuild/linux-mips64el": 0.21.5 + "@esbuild/linux-ppc64": 0.21.5 + "@esbuild/linux-riscv64": 0.21.5 + "@esbuild/linux-s390x": 0.21.5 + "@esbuild/linux-x64": 0.21.5 + "@esbuild/netbsd-x64": 0.21.5 + "@esbuild/openbsd-x64": 0.21.5 + "@esbuild/sunos-x64": 0.21.5 + "@esbuild/win32-arm64": 0.21.5 + "@esbuild/win32-ia32": 0.21.5 + "@esbuild/win32-x64": 0.21.5 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -6934,7 +6934,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 2936e29107b43e65a775b78b7bc66ddd7d76febd73840ac7e825fb22b65029422ff51038a08d19b05154f543584bd3afe7d1ef1c63900429475b17fbe61cb61f + checksum: 2911c7b50b23a9df59a7d6d4cdd3a4f85855787f374dce751148dbb13305e0ce7e880dde1608c2ab7a927fc6cec3587b80995f7fc87a64b455f8b70b55fd8ec1 languageName: node linkType: hard @@ -12604,54 +12604,15 @@ __metadata: languageName: node linkType: hard -"tsup@npm:8.0.2": - version: 8.0.2 - resolution: "tsup@npm:8.0.2" - dependencies: - bundle-require: ^4.0.0 - cac: ^6.7.12 - chokidar: ^3.5.1 - debug: ^4.3.1 - esbuild: ^0.19.2 - execa: ^5.0.0 - globby: ^11.0.3 - joycon: ^3.0.1 - postcss-load-config: ^4.0.1 - resolve-from: ^5.0.0 - rollup: ^4.0.2 - source-map: 0.8.0-beta.0 - sucrase: ^3.20.3 - tree-kill: ^1.2.2 - peerDependencies: - "@microsoft/api-extractor": ^7.36.0 - "@swc/core": ^1 - postcss: ^8.4.12 - typescript: ">=4.5.0" - peerDependenciesMeta: - "@microsoft/api-extractor": - optional: true - "@swc/core": - optional: true - postcss: - optional: true - typescript: - optional: true - bin: - tsup: dist/cli-default.js - tsup-node: dist/cli-node.js - checksum: ebd0c662efdc2a04e80251aa11832d3def9cf3bf120c579975af6d50183fa0397d07d5bcee0688258a91c154a3c5db72ee4c5dca367b58552d225bc8a89d67d0 - languageName: node - linkType: hard - -"tsup@patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": - version: 8.0.2 - resolution: "tsup@patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch::version=8.0.2&hash=ce4dd6&locator=%40metamask%2Fcore-monorepo%40workspace%3A." +"tsup@npm:^8.0.2": + version: 8.1.0 + resolution: "tsup@npm:8.1.0" dependencies: bundle-require: ^4.0.0 cac: ^6.7.12 chokidar: ^3.5.1 debug: ^4.3.1 - esbuild: ^0.19.2 + esbuild: ^0.21.4 execa: ^5.0.0 globby: ^11.0.3 joycon: ^3.0.1 @@ -12678,7 +12639,7 @@ __metadata: bin: tsup: dist/cli-default.js tsup-node: dist/cli-node.js - checksum: 69cb678c075a49a4285c61ece6f70016b0c7ba7e2a958e95bce1a79b63b631563fef6b689a6729cdc0f59fcd40c99c2aac18bd14395c656d35182d670ec259bf + checksum: 15b759e01313f62edbf6900de547ba2942e15c49b3b699bafe0e544530072a548c0e52799861c2ff7322a1c2454dd013ace55695d5e95e8987e6003f28e9b0c0 languageName: node linkType: hard From aceb33341933a0b505fb30e77e06766e8f310ea2 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:16:27 -0400 Subject: [PATCH 15/47] Bump dependencies requiring new releases to latest - Bump dependency `@metamask/abi-utils` from `^2.0.2` to `^2.1.0`. - Bump dependency `@metamask/eth-snap-keyring` from `^4.1.1` to `^4.3.0`. - Bump dependency `@metamask/keyring-api` from `^6.1.1` to `^6.5.0`. - Bump dependency `@metamask/snaps-sdk` from `^4.2.0` to `^4.5.0`. - Bump dependency `@metamask/snaps-utils` from `^7.4.0` to `^7.5.0`. --- package.json | 2 +- packages/accounts-controller/package.json | 4 +- packages/chain-controller/package.json | 4 +- yarn.lock | 52 +++++++++++++++++++++-- 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index ae11f5dac0..83f920893d 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/keyring-api@^6.1.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", "@metamask/keyring-api@^6.3.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", + "@metamask/keyring-api@^6.4.0": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 08e92c48c9..b8ed61400e 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -46,8 +46,8 @@ "@metamask/eth-snap-keyring": "^4.3.1", "@metamask/keyring-api": "^8.0.0", "@metamask/keyring-controller": "^17.1.0", - "@metamask/snaps-sdk": "^4.2.0", - "@metamask/snaps-utils": "^7.4.0", + "@metamask/snaps-sdk": "^4.4.1", + "@metamask/snaps-utils": "^7.4.1", "@metamask/utils": "^8.3.0", "deepmerge": "^4.2.2", "ethereum-cryptography": "^2.1.2", diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index fffd530647..b75ae7fdbe 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -45,8 +45,8 @@ "@metamask/chain-api": "^0.0.1", "@metamask/keyring-api": "^8.0.0", "@metamask/snaps-controllers": "^8.1.1", - "@metamask/snaps-sdk": "^4.2.0", - "@metamask/snaps-utils": "^7.4.0", + "@metamask/snaps-sdk": "^4.4.1", + "@metamask/snaps-utils": "^7.4.1", "@metamask/utils": "^8.3.0", "uuid": "^8.3.2" }, diff --git a/yarn.lock b/yarn.lock index a5cc9d13d8..3da83ee125 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2204,8 +2204,8 @@ __metadata: "@metamask/keyring-api": ^8.0.0 "@metamask/keyring-controller": ^17.1.0 "@metamask/snaps-controllers": ^8.1.1 - "@metamask/snaps-sdk": ^4.2.0 - "@metamask/snaps-utils": ^7.4.0 + "@metamask/snaps-sdk": ^4.4.1 + "@metamask/snaps-utils": ^7.4.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 "@types/readable-stream": ^2.3.0 @@ -2463,8 +2463,8 @@ __metadata: "@metamask/chain-api": ^0.0.1 "@metamask/keyring-api": ^8.0.0 "@metamask/snaps-controllers": ^8.1.1 - "@metamask/snaps-sdk": ^4.2.0 - "@metamask/snaps-utils": ^7.4.0 + "@metamask/snaps-sdk": ^4.4.1 + "@metamask/snaps-utils": ^7.4.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 "@types/readable-stream": ^2.3.0 @@ -3754,6 +3754,20 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-sdk@npm:^4.4.1": + version: 4.4.1 + resolution: "@metamask/snaps-sdk@npm:4.4.1" + dependencies: + "@metamask/key-tree": ^9.1.1 + "@metamask/providers": ^17.0.0 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/utils": ^8.3.0 + fast-xml-parser: ^4.3.4 + superstruct: ^1.0.3 + checksum: 29dfc36821e77d033ddc1b8f1b8924b4880aca41a25e1767741b50659990a79d3026f3975613090342e98d0cf8d876a0e003edb23ff39d2927dc6473d5c441f9 + languageName: node + linkType: hard + "@metamask/snaps-sdk@npm:^4.4.2": version: 4.4.2 resolution: "@metamask/snaps-sdk@npm:4.4.2" @@ -3826,6 +3840,36 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-utils@npm:^7.4.1": + version: 7.4.1 + resolution: "@metamask/snaps-utils@npm:7.4.1" + dependencies: + "@babel/core": ^7.23.2 + "@babel/types": ^7.23.0 + "@metamask/base-controller": ^5.0.2 + "@metamask/key-tree": ^9.1.1 + "@metamask/permission-controller": ^9.0.2 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/slip44": ^3.1.0 + "@metamask/snaps-registry": ^3.1.0 + "@metamask/snaps-sdk": ^4.4.1 + "@metamask/utils": ^8.3.0 + "@noble/hashes": ^1.3.1 + "@scure/base": ^1.1.1 + chalk: ^4.1.2 + cron-parser: ^4.5.0 + fast-deep-equal: ^3.1.3 + fast-json-stable-stringify: ^2.1.0 + marked: ^12.0.1 + rfdc: ^1.3.0 + semver: ^7.5.4 + ses: ^1.1.0 + superstruct: ^1.0.3 + validate-npm-package-name: ^5.0.0 + checksum: d1d6d3c769c33df88fb6e4fc852cdfe1e400b25b1cae020e729f1bfe8a094804cf901700afbbf1372cc1e95f697127b5847bf3a85b46b403ba2ae64ee5750d22 + languageName: node + linkType: hard + "@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" From fc9c89ffa52dd875a6ad272988d0c40eb7ed87bd Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:16:46 -0400 Subject: [PATCH 16/47] Apply yarn patch for `@metamask/snaps-sdk` `^4.4.1` --- ...amask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch | 86 +++++++++++++++++++ package.json | 5 +- yarn.lock | 57 ++---------- 3 files changed, 97 insertions(+), 51 deletions(-) create mode 100644 .yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch diff --git a/.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch b/.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch new file mode 100644 index 0000000000..0dae7848a6 --- /dev/null +++ b/.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch @@ -0,0 +1,86 @@ +diff --git a/dist/index.js.map b/dist/index.js.map +index da7feadc6949b1fc3ebe7239b4f25db8583c47aa..e146a5978b99b12d9b717e5233099ca4027a3d64 100644 +--- a/dist/index.js.map ++++ b/dist/index.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,K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N,gBAAeI,cAAaC,aAAY,WAAW,CAAC;AAAA,EACzE,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCV;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_utils","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} +\ No newline at end of file ++{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OA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AAY,WAAW,CAAC;AAAA,EACzE,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCV;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_utils","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} +\ No newline at end of file +diff --git a/dist/index.mjs.map b/dist/index.mjs.map +index 6771a643c5401d86a99a6ebcc5301082de0b36c7..23de547d78e851c5e73d3c73c5c80ab5290a41bc 100644 +--- a/dist/index.mjs.map ++++ b/dist/index.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA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AA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DZ;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBH,QAAOC,SAAO,GAAGG,WAAU;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union","JsonStruct"]} +\ No newline at end of file ++{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AA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AM,mBAAyC,UAAU;AAAA,EAC9DZ;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBH,QAAOC,SAAO,GAAGG,WAAU;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union","JsonStruct"]} +\ No newline at end of file +diff --git a/dist/jsx/index.js.map b/dist/jsx/index.js.map +index 4cda1449ef3341a5cdc62075e62c1d2850fc8be2..92f7a08191f98c0aae8f43bb15606a5d7aba0c7c 100644 +--- a/dist/jsx/index.js.map ++++ b/dist/jsx/index.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAmBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACvB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACdxE,IAAMC,QAAO;AAiBN,IAAM,QAAQ,oBAA6CA,KAAI;;;AChBtE,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AClBpE,IAAMC,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KAAI;;;ACfpE,IAAMC,QAAO;AAeN,IAAM,SAAS,oBAA8CA,KAAI;;;AC1BxE,IAAMC,QAAO;AAcN,IAAM,UAAU,oBAA+CA,KAAI;;;ACT1E,IAAMC,SAAO;AAaN,I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AM,gBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,aACE,4BAAc,KAAK,SACnB,0BAAY,OAAO,MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAA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ACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,aACE,4BAAc,KAAK,SACnB,0BAAY,OAAO,MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file +diff --git a/dist/jsx/index.mjs.map b/dist/jsx/index.mjs.map +index 37d1e93ebb4c7b96ee2c97403070041d5294643b..7698f9a5a6cb65f1b620f9ddc713b8d1c9eacffe 100644 +--- a/dist/jsx/index.mjs.map ++++ b/dist/jsx/index.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AA4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAmBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACvB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACdxE,IAAMC,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,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n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EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} +\ No newline at end of file +diff --git a/dist/jsx/jsx-dev-runtime.js.map b/dist/jsx/jsx-dev-runtime.js.map +index 48aa98ff1c8e93e24d2d7aab993b5086c0e26e73..5eeb9d4013a09181b0259eabf0810ecfb1957230 100644 +--- a/dist/jsx/jsx-dev-runtime.js.map ++++ b/dist/jsx/jsx-dev-runtime.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAYO;;;AClBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AAC3E,aAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,QACpB,mBAAAC,SAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,aAAS,mBAAAC,OAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,0BAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,SACA;AACA,SAAO,MAAM,OAAO;AAItB;;;AFrCO,IAAM,YAA2B,UAAU,KAAC,4BAAO,OAAG,4BAAO,CAAC,CAAC;AAK/D,IAAM,sBAA+C;AAAA,MAC1D,4BAAO;AACT;AAKO,IAAM,oBAA8C,4BAAO;AAAA,EAChE,UAAM,4BAAO;AAAA,EACb,WAAO,gCAAO,4BAAO,GAAG,uBAAU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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAYO;;;AClBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AAC3E,aAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,QACpB,m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AAA,EACd,UAAU,UAAU,CAAC,eAAe,aAAa,YAAY,WAAW,CAAC;AAAA,EACzE,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} +\ No newline at end of file +diff --git a/dist/jsx/jsx-dev-runtime.mjs.map b/dist/jsx/jsx-dev-runtime.mjs.map +index 969a7caaed03191c746822b48f5beb8220840536..abe0078924086a27b43e17c1a3dfd2ce03be6164 100644 +--- a/dist/jsx/jsx-dev-runtime.mjs.map ++++ b/dist/jsx/jsx-dev-runtime.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AClBP;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AA0BA,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,SAAS,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,SACA;A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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMA,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,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;AAExB,SAAOA;AACT;","names":["element"]} +\ No newline at end of file +diff --git a/dist/tsconfig.build.tsbuildinfo b/dist/tsconfig.build.tsbuildinfo +index e7e9da52b4541db95e7e7c67522dc5006a76adb9..381d393659da9e27e8f43843f54bd9fe9fbfb254 100644 +--- a/dist/tsconfig.build.tsbuildinfo ++++ b/dist/tsconfig.build.tsbuildinfo +@@ -1 +1 @@ +-{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Option.ts","../src/jsx/components/form/Dropdown.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Value.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","d6e6620a30d582182acc3f0a992a0c311adc589f111096aea11ab83fc09a5ccc","6213b8f686f56beab22b59a0f468590fd3a4c5fa931236a017efeca91d7c9584","c451cec9a588b1f105a5ea2c6063d4fca112b9d70105cacdadda0e1ef67e9379","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"d5d9407858477b9fb1d5127bb1da9d0532799e98f2d765ca0f83d7e0617aead9","signature":"c7298e68632ab03155f6de963d3d09cc4a5874c28a81524f56c667d8a052e538"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"89c7df2ac4b33507472aa18cfbdac688e7e0b749ee584d9d41884721c4e603c6","signature":"6ee568039016b81ed70292a595ab781ab978cba4243a5fe49507040ee4f7ac8a"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"a3c40e930415aa32fdcdb14f90688010d19fda009833d7dd93abcc71e03dd8af","signature":"a68bb369c4ba8ab43a78f3fad2d3ec130e1418bc946521b9c84e9b336d6e88f1"},{"version":"0b4c309c6b8685487f97d6fd6a7441b93dd4ca3c4a8f2bcc96a55e5f9d28eee2","signature":"65f219e6e1f9d27c677a49d41ae7989b83bf6baa56debbeb50d95c3ab21632e2"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"854caddc363811a2917620e1ef1a986fceec21e1c695561c7122859df49e0431","signature":"c89354ae268153d965011e484150f0c92faa87f3f66507c25b496973178e0400"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"a1d7df4a3dbe98d0633eeca6be38c65827d29865fe8d48a1005e9aad0fa3cbb9","signature":"a6f4816a634bb1ceb513634c1ef7c0535f461ed2565336eed69f6ac2babbe15b"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"d1121f9f0f812490afd777a543b1412ea50ea95da6f5e83f5d8b8617c2ca0ec4","signature":"608c45069e89c4c8f0ab29f896cc93c6553808072d6304b23611b6c6de3c24bb"},{"version":"1db66cc3eb3ef433289a7fcbac5c9bd9bfdde251188cc5886e016b8e60953aa7","signature":"22cbabe752781b5f35482af9d1fcf1455cb1ece74e8b84700d4abcb44abe3776"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"8bdd4f7af884080d0c18ee346e3ffcc433824d67fde761a71879fea59c8648d3","signature":"a5d1209c7bf277af86281392d46e12ce3dd6052586053f757fb2e606cc75c0f3"},{"version":"ad21d1b3fe8673f3e0dc0e8a592016ca4158a9414471c6d6531aff27713c3e51","signature":"c1f11d9b42bfb0823d34d93c58df91ffb6690b5a717b7d310d83f258f1784e58"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"710e8c05b091c0294e0d0df1a734f78fc32293cbf10f51cc91880bc9e0b0a0c6","signature":"775b207f00d4df5b3b0b536aa696d572cdd2cabe8ea18dd28e8b52f691fa2a55"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"c485c6497f7587314c4c4a59b74850cbca4c0c4bc08146a918cfd237ef821dbb"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"e9eec004735b1bf7015edf5400aeb914a53132134d230e93786590d904d094cc"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"f46ba7c6fa7fcc8b3d57c4618c18db3f4d8bfe1fcab5551d7f6d9a82cf4d6078"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"977f9752e7185453337e20609747d21846556482c0f1658e29edd182985cafbc","signature":"4e7ac7e5dd58a6c29c724728b031669e3068b194b62c2b83f92e76a36cb34dbb"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"82c5caf9da87baeacfa390572521720578ce4951590a8539482aed97b8c18514","signature":"79576487ac18e047e8192fc582ff488ce375fe4df0cb028a17f831cf42b976f2"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"518d468edb1e58fe5187cd892d3096ae7764a5f6c759303c508a5172a1ec0e62","signature":"db34610570eed46b8b72bc662a91261200b8578af0ac02781ce7d9aca99bc683"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,294],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,167],[108,154,168],[108,168,169,170,171,172,173],[108,188,197,198,201],[108,188,197,200],[108,188,197,199,201],[108,189,192,193,195],[108,189,190,191],[108,192,193,195,196],[108,189,190,194],[108,200,206],[108,188,197,200,206],[108,197,200,206],[108,197,200,202,203,204,205],[108,188,197,198,199,200,201,206],[108,188,197],[108,154,167,174,175],[108,176],[108,115,154,176,179,180],[108,115,154,167,174,176,179],[108,180],[108,175,176,177,180,181,182,183,184],[108,115,177,179,182],[108,175,182],[108,154,174],[108,154,157],[108,157,158],[108,157,158,159,160],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,189],[108,294,295,296,297,298],[108,294,296],[81,108,115,301],[72,108,115],[108,115,304],[108,306],[108,307,308,310],[96,108,115],[107,108,115,317],[81,108,115],[108,144],[108,323,324],[108,321,322,323],[78,81,108,115,314,315,316],[108,302,316,317,328],[108,309],[78,108,115,332],[79,108,115],[108,336],[108,342],[78,81,83,86,96,107,108,115],[108,347],[108,347,349],[108,348],[108,355,360],[108,353,356],[108,353,356,357,358],[108,355],[108,352,359],[108,354],[78,108,110,115,374,375,377],[108,376],[108,391],[108,379,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,382,383,384,385,386,387,388,389,390,391],[108,380,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,381,383,384,385,386,387,388,389,390,391],[108,379,380,381,382,384,385,386,387,388,389,390,391],[108,379,380,381,382,383,385,386,387,388,389,390,391],[108,379,380,381,382,383,384,386,387,388,389,390,391],[108,379,380,381,382,383,384,385,387,388,389,390,391],[108,379,380,381,382,383,384,385,386,388,389,390,391],[108,379,380,381,382,383,384,385,386,387,389,390,391],[108,379,380,381,382,383,384,385,386,387,388,390,391],[108,379,380,381,382,383,384,385,386,387,388,389,391],[108,379,380,381,382,383,384,385,386,387,388,389,390],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,342,401],[108,401,402,403,404,405],[108,338,339,340,341],[108,115,178],[79,108,115,333],[108,411,450],[108,411,435,450],[108,450],[108,411],[108,411,436,450],[108,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449],[108,436,450],[79,96,108,115,313],[79,81,108,115],[79,108,329],[81,108,115,327],[108,327],[108,326],[108,115,462,463,464,465,466,467,468,469,470,471,472],[108,461,462,471],[108,462,471],[108,454,461,462,471],[108,462],[71,108,461,471],[108,461,462,463,464,465,466,467,468,469,470,472],[78,81,83,96,104,107,108,113,115],[108,476],[78,96,108,115],[108,332],[108,330,331],[108,363],[108,362,363],[108,362],[108,362,363,364,366,367,370,371,372,373],[108,363,367],[108,362,363,364,366,367,368,369],[108,362,367],[108,367,371],[108,363,364,365],[108,364],[108,362,363,367],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,156,161,289],[108,154,156,289],[108,154,156,257],[108,154,156,162,257,285,289,290,291],[108,154,156,161,162],[108,154,156],[108,156,163,164,165,166,286,288],[44,50,108,156,166,285],[44,50,108,156,165],[108,154,156,287],[108,155,156],[108,155,156,231],[108,155,156,216,228,233,234],[108,155,156,227,231],[108,155,156,221],[108,155,156,220,222,223],[108,155,156,220,224],[108,156,220,221,222,223,224,225],[108,155,156,228],[108,156,229,230],[108,156,216,217,218,219,226,227,228,231,232,233,234,235,236],[108,155,156,237,238,239],[108,155,156,238],[44,50,108,154,155,156,237,285,289],[108,156],[108,156,272],[108,156,285],[108,156,275,276,277,278,279,280,281,282,283],[108,154,156,208],[108,156,257,281,289],[108,156,208,285,289],[50,108,156,258],[108,156,208,209,258,261,271,272,273,284],[50,108,154,156,240,257],[108,156,285,289],[108,156,207,209],[108,156,209],[108,156,289],[108,156,258],[108,154,156,261],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,270],[108,154,156,263],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[108,154,156,207,208],[108,156,185,271],[108,154,156,209],[50,108,154,156,241,255],[50,108,154,156,255],[50,108,154,156,241,242],[50,108,156,241,242,289],[50,108,156,241,242],[50,108,156,241,242,248,249],[108,156,243,244,245,246,247,248,249,250,251,252,253,254],[50,108,156,241,242,243,244,245,246,247,248,249,250,251,252,253],[50,108,156,241,242,243,247,251,289],[108,156,241,255,256],[50,108,156],[154,162],[154,289],[257],[154,162,257,285,289,290,291],[154,161,162],[154],[44,50,285],[44,50,165],[155],[155,231],[155,216,228,233,234],[155,227,231],[155,221],[155,220,222,223],[155,220,224],[220,221,222,223,224,225],[229,230],[216,217,218,219,226,227,228,231,232,233,234,235,236],[155,156,237,238,239],[50,155,237,289],[272],[285],[154,208],[257,281,289],[208,285,289],[50,258],[208,209,258,261,271,272,273,284],[50,154,240,257],[285,289],[207,209],[209],[289],[258],[154,261],[154,263],[186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[154,207,208],[185,271],[154,209],[50,241,255],[255],[50,241],[50]],"referencedMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,197],[162,198],[291,199],[292,200],[163,201],[164,202],[165,202],[289,203],[286,204],[166,205],[288,206],[155,202],[216,207],[217,207],[218,207],[219,207],[232,207],[233,207],[227,208],[235,209],[236,207],[228,210],[234,207],[220,207],[222,211],[224,212],[225,213],[223,207],[221,207],[226,214],[229,215],[230,207],[231,216],[237,217],[240,218],[239,219],[156,207],[238,220],[208,221],[273,222],[275,202],[276,223],[284,224],[277,202],[278,221],[279,225],[280,202],[282,226],[281,227],[283,228],[274,2],[285,229],[258,230],[186,223],[187,231],[210,232],[211,233],[212,232],[213,221],[214,202],[215,234],[259,235],[260,221],[262,236],[271,237],[264,238],[263,202],[265,202],[266,198],[270,239],[267,234],[268,236],[269,223],[209,240],[272,241],[261,242],[242,243],[256,244],[243,245],[248,246],[244,247],[245,247],[250,248],[246,247],[247,246],[255,249],[249,246],[254,250],[252,251],[253,247],[251,247],[257,252],[241,253]],"exportedModulesMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,254],[162,255],[291,256],[292,257],[163,258],[164,259],[165,259],[289,203],[286,260],[166,261],[155,259],[216,262],[217,262],[218,262],[219,262],[232,262],[233,262],[227,263],[235,264],[236,262],[228,265],[234,262],[220,262],[222,266],[224,267],[225,268],[223,262],[221,262],[226,269],[229,262],[230,262],[231,270],[237,271],[240,272],[239,262],[156,262],[238,273],[273,274],[275,259],[276,275],[284,224],[277,259],[279,276],[280,259],[282,277],[281,278],[283,279],[285,280],[258,281],[186,275],[187,282],[210,283],[211,284],[212,283],[214,259],[215,285],[259,286],[262,287],[271,237],[264,288],[263,259],[265,259],[266,255],[270,289],[267,285],[268,287],[269,275],[209,290],[272,291],[261,292],[242,293],[256,294],[243,295],[248,295],[244,295],[245,295],[250,295],[246,295],[247,295],[255,249],[249,295],[254,295],[252,295],[253,295],[251,295],[257,252],[241,296]],"semanticDiagnosticsPerFile":[296,294,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,168,169,170,171,172,174,173,199,201,200,188,196,192,193,197,195,202,203,204,206,205,207,198,176,177,182,180,181,185,183,184,175,158,160,159,161,157,167,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,191,189,190,194,293,299,295,297,298,300,302,303,305,308,307,311,312,318,301,319,145,320,325,321,324,323,317,329,310,309,333,334,335,306,337,343,344,345,346,304,347,348,350,351,361,353,357,359,358,356,360,355,354,376,377,322,378,392,380,381,379,382,383,384,385,386,387,388,389,390,391,393,313,394,395,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,396,397,398,340,399,316,315,400,402,404,401,403,405,406,338,342,179,178,407,408,409,410,341,435,436,411,414,433,434,424,423,421,416,429,427,431,415,428,432,417,418,430,412,419,420,422,426,437,425,413,450,449,444,446,445,438,439,441,443,447,448,440,442,314,451,452,328,326,327,453,454,455,456,375,336,457,458,459,460,473,472,463,464,465,466,467,468,469,462,470,471,461,474,475,476,477,478,118,352,339,287,330,332,331,364,373,362,363,374,369,370,368,372,366,365,371,367,349,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,290,162,291,292,163,164,165,289,286,166,288,155,216,217,218,219,232,233,227,235,236,228,234,220,222,224,225,223,221,226,229,230,231,237,240,239,156,238,208,273,275,276,284,277,278,279,280,282,281,283,274,285,258,186,187,210,211,212,213,214,215,259,260,262,271,264,263,265,266,270,267,268,269,209,272,261,242,256,243,248,244,245,250,246,247,255,249,254,252,253,251,257,241],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} +\ No newline at end of file ++{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Option.ts","../src/jsx/components/form/Dropdown.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Value.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","d6e6620a30d582182acc3f0a992a0c311adc589f111096aea11ab83fc09a5ccc","6213b8f686f56beab22b59a0f468590fd3a4c5fa931236a017efeca91d7c9584","c451cec9a588b1f105a5ea2c6063d4fca112b9d70105cacdadda0e1ef67e9379","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"d5d9407858477b9fb1d5127bb1da9d0532799e98f2d765ca0f83d7e0617aead9","signature":"c7298e68632ab03155f6de963d3d09cc4a5874c28a81524f56c667d8a052e538"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"89c7df2ac4b33507472aa18cfbdac688e7e0b749ee584d9d41884721c4e603c6","signature":"6ee568039016b81ed70292a595ab781ab978cba4243a5fe49507040ee4f7ac8a"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"a3c40e930415aa32fdcdb14f90688010d19fda009833d7dd93abcc71e03dd8af","signature":"a68bb369c4ba8ab43a78f3fad2d3ec130e1418bc946521b9c84e9b336d6e88f1"},{"version":"0b4c309c6b8685487f97d6fd6a7441b93dd4ca3c4a8f2bcc96a55e5f9d28eee2","signature":"65f219e6e1f9d27c677a49d41ae7989b83bf6baa56debbeb50d95c3ab21632e2"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"854caddc363811a2917620e1ef1a986fceec21e1c695561c7122859df49e0431","signature":"c89354ae268153d965011e484150f0c92faa87f3f66507c25b496973178e0400"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"a1d7df4a3dbe98d0633eeca6be38c65827d29865fe8d48a1005e9aad0fa3cbb9","signature":"a6f4816a634bb1ceb513634c1ef7c0535f461ed2565336eed69f6ac2babbe15b"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"d1121f9f0f812490afd777a543b1412ea50ea95da6f5e83f5d8b8617c2ca0ec4","signature":"608c45069e89c4c8f0ab29f896cc93c6553808072d6304b23611b6c6de3c24bb"},{"version":"1db66cc3eb3ef433289a7fcbac5c9bd9bfdde251188cc5886e016b8e60953aa7","signature":"22cbabe752781b5f35482af9d1fcf1455cb1ece74e8b84700d4abcb44abe3776"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"8bdd4f7af884080d0c18ee346e3ffcc433824d67fde761a71879fea59c8648d3","signature":"a5d1209c7bf277af86281392d46e12ce3dd6052586053f757fb2e606cc75c0f3"},{"version":"ad21d1b3fe8673f3e0dc0e8a592016ca4158a9414471c6d6531aff27713c3e51","signature":"c1f11d9b42bfb0823d34d93c58df91ffb6690b5a717b7d310d83f258f1784e58"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"710e8c05b091c0294e0d0df1a734f78fc32293cbf10f51cc91880bc9e0b0a0c6","signature":"775b207f00d4df5b3b0b536aa696d572cdd2cabe8ea18dd28e8b52f691fa2a55"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"c485c6497f7587314c4c4a59b74850cbca4c0c4bc08146a918cfd237ef821dbb"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"e9eec004735b1bf7015edf5400aeb914a53132134d230e93786590d904d094cc"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"f46ba7c6fa7fcc8b3d57c4618c18db3f4d8bfe1fcab5551d7f6d9a82cf4d6078"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"977f9752e7185453337e20609747d21846556482c0f1658e29edd182985cafbc","signature":"4e7ac7e5dd58a6c29c724728b031669e3068b194b62c2b83f92e76a36cb34dbb"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"82c5caf9da87baeacfa390572521720578ce4951590a8539482aed97b8c18514","signature":"79576487ac18e047e8192fc582ff488ce375fe4df0cb028a17f831cf42b976f2"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"518d468edb1e58fe5187cd892d3096ae7764a5f6c759303c508a5172a1ec0e62","signature":"db34610570eed46b8b72bc662a91261200b8578af0ac02781ce7d9aca99bc683"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,294],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,167],[108,154,168],[108,168,169,170,171,172,173],[108,188,197,198,201],[108,188,197,200],[108,188,197,199,201],[108,189,192,193,195],[108,189,190,191],[108,192,193,195,196],[108,189,190,194],[108,200,206],[108,188,197,200,206],[108,197,200,206],[108,197,200,202,203,204,205],[108,188,197,198,199,200,201,206],[108,188,197],[108,154,167,174,175],[108,176],[108,115,154,176,179,180],[108,115,154,167,174,176,179],[108,180],[108,175,176,177,180,181,182,183,184],[108,115,177,179,182],[108,175,182],[108,154,174],[108,154,157],[108,157,158],[108,157,158,159,160],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,189],[108,294,295,296,297,298],[108,294,296],[81,108,115,301],[72,108,115],[108,115,304],[108,306],[108,307,308,310],[96,108,115],[107,108,115,317],[81,108,115],[108,144],[108,323,324],[108,321,322,323],[78,81,108,115,314,315,316],[108,302,316,317,328],[108,309],[78,108,115,332],[79,108,115],[108,336],[108,342],[78,81,83,86,96,107,108,115],[108,347],[108,347,349],[108,348],[108,355,360],[108,353,356],[108,353,356,357,358],[108,355],[108,352,359],[108,354],[78,108,110,115,374,375,377],[108,376],[108,391],[108,379,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,382,383,384,385,386,387,388,389,390,391],[108,380,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,381,383,384,385,386,387,388,389,390,391],[108,379,380,381,382,384,385,386,387,388,389,390,391],[108,379,380,381,382,383,385,386,387,388,389,390,391],[108,379,380,381,382,383,384,386,387,388,389,390,391],[108,379,380,381,382,383,384,385,387,388,389,390,391],[108,379,380,381,382,383,384,385,386,388,389,390,391],[108,379,380,381,382,383,384,385,386,387,389,390,391],[108,379,380,381,382,383,384,385,386,387,388,390,391],[108,379,380,381,382,383,384,385,386,387,388,389,391],[108,379,380,381,382,383,384,385,386,387,388,389,390],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,342,401],[108,401,402,403,404,405],[108,338,339,340,341],[108,115,178],[79,108,115,333],[108,411,450],[108,411,435,450],[108,450],[108,411],[108,411,436,450],[108,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449],[108,436,450],[79,96,108,115,313],[79,81,108,115],[79,108,329],[81,108,115,327],[108,327],[108,326],[108,115,462,463,464,465,466,467,468,469,470,471,472],[108,461,462,471],[108,462,471],[108,454,461,462,471],[108,462],[71,108,461,471],[108,461,462,463,464,465,466,467,468,469,470,472],[78,81,83,96,104,107,108,113,115],[108,476],[78,96,108,115],[108,332],[108,330,331],[108,363],[108,362,363],[108,362],[108,362,363,364,366,367,370,371,372,373],[108,363,367],[108,362,363,364,366,367,368,369],[108,362,367],[108,367,371],[108,363,364,365],[108,364],[108,362,363,367],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,156,161,289],[108,154,156,289],[108,154,156,257],[108,154,156,162,257,285,289,290,291],[108,154,156,161,162],[108,154,156],[108,156,163,164,165,166,286,288],[44,50,108,156,166,285],[44,50,108,156,165],[108,154,156,287],[108,155,156],[108,155,156,231],[108,155,156,216,228,233,234],[108,155,156,227,231],[108,155,156,221],[108,155,156,220,222,223],[108,155,156,220,224],[108,156,220,221,222,223,224,225],[108,155,156,228],[108,156,229,230],[108,156,216,217,218,219,226,227,228,231,232,233,234,235,236],[108,155,156,237,238,239],[108,155,156,238],[44,50,108,154,155,156,237,285,289],[108,156],[108,156,272],[108,156,285],[108,156,275,276,277,278,279,280,281,282,283],[108,154,156,208],[108,156,257,281,289],[108,156,208,285,289],[50,108,156,258],[108,156,208,209,258,261,271,272,273,284],[50,108,154,156,240,257],[108,156,285,289],[108,156,207,209],[108,156,209],[108,156,289],[108,156,258],[108,154,156,261],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,270],[108,154,156,263],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[108,154,156,207,208],[108,156,185,271],[108,154,156,209],[50,108,154,156,241,255],[50,108,154,156,255],[50,108,154,156,241,242],[50,108,156,241,242,289],[50,108,156,241,242],[50,108,156,241,242,248,249],[108,156,243,244,245,246,247,248,249,250,251,252,253,254],[50,108,156,241,242,243,244,245,246,247,248,249,250,251,252,253],[50,108,156,241,242,243,247,251,289],[108,156,241,255,256],[50,108,156],[154,162],[154,289],[257],[154,162,257,285,289,290,291],[154,161,162],[154],[44,50,285],[44,50,165],[155],[155,231],[155,216,228,233,234],[155,227,231],[155,221],[155,220,222,223],[155,220,224],[220,221,222,223,224,225],[229,230],[216,217,218,219,226,227,228,231,232,233,234,235,236],[155,156,237,238,239],[50,155,237,289],[272],[285],[154,208],[257,281,289],[208,285,289],[50,258],[208,209,258,261,271,272,273,284],[50,154,240,257],[285,289],[207,209],[209],[289],[258],[154,261],[154,263],[186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[154,207,208],[185,271],[154,209],[50,241,255],[255],[50,241],[50]],"referencedMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,197],[162,198],[291,199],[292,200],[163,201],[164,202],[165,202],[289,203],[286,204],[166,205],[288,206],[155,202],[216,207],[217,207],[218,207],[219,207],[232,207],[233,207],[227,208],[235,209],[236,207],[228,210],[234,207],[220,207],[222,211],[224,212],[225,213],[223,207],[221,207],[226,214],[229,215],[230,207],[231,216],[237,217],[240,218],[239,219],[156,207],[238,220],[208,221],[273,222],[275,202],[276,223],[284,224],[277,202],[278,221],[279,225],[280,202],[282,226],[281,227],[283,228],[274,2],[285,229],[258,230],[186,223],[187,231],[210,232],[211,233],[212,232],[213,221],[214,202],[215,234],[259,235],[260,221],[262,236],[271,237],[264,238],[263,202],[265,202],[266,198],[270,239],[267,234],[268,236],[269,223],[209,240],[272,241],[261,242],[242,243],[256,244],[243,245],[248,246],[244,247],[245,247],[250,248],[246,247],[247,246],[255,249],[249,246],[254,250],[252,251],[253,247],[251,247],[257,252],[241,253]],"exportedModulesMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,254],[162,255],[291,256],[292,257],[163,258],[164,259],[165,259],[289,203],[286,260],[166,261],[155,259],[216,262],[217,262],[218,262],[219,262],[232,262],[233,262],[227,263],[235,264],[236,262],[228,265],[234,262],[220,262],[222,266],[224,267],[225,268],[223,262],[221,262],[226,269],[229,262],[230,262],[231,270],[237,271],[240,272],[239,262],[156,262],[238,273],[273,274],[275,259],[276,275],[284,224],[277,259],[279,276],[280,259],[282,277],[281,278],[283,279],[285,280],[258,281],[186,275],[187,282],[210,283],[211,284],[212,283],[214,259],[215,285],[259,286],[262,287],[271,237],[264,288],[263,259],[265,259],[266,255],[270,289],[267,285],[268,287],[269,275],[209,290],[272,291],[261,292],[242,293],[256,294],[243,295],[248,295],[244,295],[245,295],[250,295],[246,295],[247,295],[255,249],[249,295],[254,295],[252,295],[253,295],[251,295],[257,252],[241,296]],"semanticDiagnosticsPerFile":[296,294,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,168,169,170,171,172,174,173,199,201,200,188,196,192,193,197,195,202,203,204,206,205,207,198,176,177,182,180,181,185,183,184,175,158,160,159,161,157,167,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,191,189,190,194,293,299,295,297,298,300,302,303,305,308,307,311,312,318,301,319,145,320,325,321,324,323,317,329,310,309,333,334,335,306,337,343,344,345,346,304,347,348,350,351,361,353,357,359,358,356,360,355,354,376,377,322,378,392,380,381,379,382,383,384,385,386,387,388,389,390,391,393,313,394,395,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,396,397,398,340,399,316,315,400,402,404,401,403,405,406,338,342,179,178,407,408,409,410,341,435,436,411,414,433,434,424,423,421,416,429,427,431,415,428,432,417,418,430,412,419,420,422,426,437,425,413,450,449,444,446,445,438,439,441,443,447,448,440,442,314,451,452,328,326,327,453,454,455,456,375,336,457,458,459,460,473,472,463,464,465,466,467,468,469,462,470,471,461,474,475,476,477,478,118,352,339,287,330,332,331,364,373,362,363,374,369,370,368,372,366,365,371,367,349,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,290,162,291,292,163,164,165,289,286,166,288,155,216,217,218,219,232,233,227,235,236,228,234,220,222,224,225,223,221,226,229,230,231,237,240,239,156,238,208,273,275,276,284,277,278,279,280,282,281,283,274,285,258,186,187,210,211,212,213,214,215,259,260,262,271,264,263,265,266,270,267,268,269,209,272,261,242,256,243,248,244,245,250,246,247,255,249,254,252,253,251,257,241],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} +\ No newline at end of file +diff --git a/dist/types/internals/jsx.d.ts b/dist/types/internals/jsx.d.ts +index 95a075622f84c1a90d0156f4c4fe30e3b3274aed..6bd2d13a1f3796273616630e0adb6b1961c5fdf9 100644 +--- a/dist/types/internals/jsx.d.ts ++++ b/dist/types/internals/jsx.d.ts +@@ -1,5 +1,4 @@ +-import type { Infer, Struct } from 'superstruct'; +-import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct/dist/utils'; ++import type { AnyStruct, EnumSchema, Infer, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, Struct, UnionToIntersection } from 'superstruct'; + import type { EmptyObject } from '../types'; + /** + * Check if a type is a union. Infers `true` if it is a union, otherwise +diff --git a/dist/types/internals/structs.d.ts b/dist/types/internals/structs.d.ts +index bbfc1289001614aa48dca8aef392f619be8281bb..956456ec616180c31647145a1ecc08efee8fcb2c 100644 +--- a/dist/types/internals/structs.d.ts ++++ b/dist/types/internals/structs.d.ts +@@ -1,6 +1,5 @@ +-import type { Infer } from 'superstruct'; ++import type { AnyStruct, Infer, InferStructTuple } from 'superstruct'; + import { Struct } from 'superstruct'; +-import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; + import type { EnumToUnion } from './helpers'; + /** + * A wrapper of `superstruct`'s `literal` struct that also defines the name of diff --git a/package.json b/package.json index 83f920893d..294ac4ede5 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,9 @@ "@metamask/keyring-api@^6.4.0": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", - "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", - "@metamask/snaps-sdk@^4.2.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", + "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch", + "@metamask/snaps-sdk@^4.2.0": "patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch", + "@metamask/snaps-sdk@^4.4.1": "patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch", "@metamask/snaps-utils@^7.0.3": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/snaps-utils@^7.3.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", diff --git a/yarn.lock b/yarn.lock index 3da83ee125..86dd9abc43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3048,7 +3048,7 @@ __metadata: languageName: node linkType: hard -"@metamask/key-tree@npm:^9.1.0, @metamask/key-tree@npm:^9.1.1": +"@metamask/key-tree@npm:^9.1.1": version: 9.1.1 resolution: "@metamask/key-tree@npm:9.1.1" dependencies: @@ -3496,26 +3496,6 @@ __metadata: languageName: unknown linkType: soft -"@metamask/providers@npm:^16.1.0": - version: 16.1.0 - resolution: "@metamask/providers@npm:16.1.0" - dependencies: - "@metamask/json-rpc-engine": ^8.0.1 - "@metamask/json-rpc-middleware-stream": ^7.0.1 - "@metamask/object-multiplex": ^2.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/safe-event-emitter": ^3.1.1 - "@metamask/utils": ^8.3.0 - detect-browser: ^5.2.0 - extension-port-stream: ^3.0.0 - fast-deep-equal: ^3.1.3 - is-stream: ^2.0.0 - readable-stream: ^3.6.2 - webextension-polyfill: ^0.10.0 - checksum: 85e40140f342a38112c3d7cee436751a2be4c575cc4f815ab48a73b549abc2d756bf4a10e4b983e91dbd38076601f992531edb6d8d674aebceae32ef7e299275 - languageName: node - linkType: hard - "@metamask/providers@npm:^17.0.0": version: 17.1.0 resolution: "@metamask/providers@npm:17.1.0" @@ -3740,21 +3720,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@npm:4.2.0": - version: 4.2.0 - resolution: "@metamask/snaps-sdk@npm:4.2.0" - dependencies: - "@metamask/key-tree": ^9.1.0 - "@metamask/providers": ^16.1.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 - fast-xml-parser: ^4.3.4 - superstruct: ^1.0.3 - checksum: f9b0e6d7600680183e69d419f5a802208fdc119c7d1226a74076f3b8b8c581850b135392c2f35c391305fc37406973afeb19d8909101580ec16b63fd2f200a8c - languageName: node - linkType: hard - -"@metamask/snaps-sdk@npm:^4.4.1": +"@metamask/snaps-sdk@npm:4.4.1": version: 4.4.1 resolution: "@metamask/snaps-sdk@npm:4.4.1" dependencies: @@ -3795,17 +3761,17 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": - version: 4.2.0 - resolution: "@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch::version=4.2.0&hash=3dabd5&locator=%40metamask%2Fcore-monorepo%40workspace%3A." +"@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": + version: 4.4.1 + resolution: "@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch::version=4.4.1&hash=d41693&locator=%40metamask%2Fcore-monorepo%40workspace%3A." dependencies: - "@metamask/key-tree": ^9.1.0 - "@metamask/providers": ^16.1.0 + "@metamask/key-tree": ^9.1.1 + "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 fast-xml-parser: ^4.3.4 superstruct: ^1.0.3 - checksum: cf8e270fc47ca72736fa12f0e77b7f0a25536e7c003ead1720f8be914039e22c49e111104db1278c41b623451a0494fe6f7422bc7685c9689f1430c7976c240b + checksum: 332ee26fb8eac652f403defa0c65bc2b4339f6e6d1fdb49b54d38db6ffbe3c29442faa20f48675c36342cba647e827f360fe508bc6bdcc359d82c7dc70ef8a20 languageName: node linkType: hard @@ -13128,13 +13094,6 @@ __metadata: languageName: node linkType: hard -"webextension-polyfill@npm:^0.10.0": - version: 0.10.0 - resolution: "webextension-polyfill@npm:0.10.0" - checksum: 4a59036bda571360c2c0b2fb03fe1dc244f233946bcf9a6766f677956c40fd14d270aaa69cdba95e4ac521014afbe4008bfa5959d0ac39f91c990eb206587f91 - languageName: node - linkType: hard - "webextension-polyfill@npm:^0.8.0": version: 0.8.0 resolution: "webextension-polyfill@npm:0.8.0" From 6af51134bd0398721178f24f41a704e31ede019e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:17:27 -0400 Subject: [PATCH 17/47] Apply yarn patch for `@metamask/snaps-utils` `^7.4.1` --- ...ask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch | 30 ++ package.json | 5 +- yarn.lock | 281 +++++++++++------- 3 files changed, 209 insertions(+), 107 deletions(-) create mode 100644 .yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch new file mode 100644 index 0000000000..2cacf4b6d3 --- /dev/null +++ b/.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch @@ -0,0 +1,30 @@ +diff --git a/dist/chunk-A6E325SZ.js.map b/dist/chunk-A6E325SZ.js.map +index 9395ea8f11127b1883cf0b26f7049254cb1bf6ac..2bab6aca282a11ec815b3a02863423af8260fb85 100644 +--- a/dist/chunk-A6E325SZ.js.map ++++ b/dist/chunk-A6E325SZ.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,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AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SA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AAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-GTAYOKI4.mjs.map b/dist/chunk-GTAYOKI4.mjs.map +index 87b357f90e691edb205eba4b1d5991f705dc61fb..15cec06a31a88f47929cc8a9b7cecaef5daa8372 100644 +--- a/dist/chunk-GTAYOKI4.mjs.map ++++ b/dist/chunk-GTAYOKI4.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAAK,UAAU,GAAG,MAAM;AAAA;AAAA,EAAQ;AAAA,MAC9B;AAAA,MACA,CAAC,GAAG,SAAS,CAAC;AAAA,MACd;AAAA,IACF,CAAC,GAAG,SAAS;AAAA;AAAA,EAAO,MAAM,KAAK,EAAE;AAAA,EACnC;AACF;AAkBO,UAAU,iBACf,OACkC;AAClC,aAAW,QAAQ,OAAO;AACxB,UAAM;AAAA,EACR;AACF;AAcO,SAAS,SAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AACF,GAAkC;AAChC,SAAO,IAAI;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,iBAAiB,MAAM,SAAS,CAAC;AAAA,IACvC;AAAA,EACF;AACF;AAcO,SAAS,iBACd,OACA,QACA,QACA,SAAS,IACT;AACA,MAAI;AACF,WAAO,OAAO,OAAO,MAAM;AAAA,EAC7B,SAAS,OAAO;AACd,QAAI,iBAAiB,aAAa;AAChC,YA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AC1B,CAAC,SAAS,GAAG,MAAM,QAAQ;AAAA,EAC7B,CAAC;AAED,QAAM,CAAC,QAAQ,IAAI,SAAS,OAAO,KAAK,EAAE,OAAO,CAAC;AAClD,MAAI,UAAU;AACZ,UAAM,IAAI;AAAA,MACR,wBAAwB,KAAK,SAAS,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,IAC5D;AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAAK,UAAU,GAAG,MAAM;AAAA;AAAA,EAAQ;AAAA,MAC9B;AAAA,MACA,CAAC,GAAG,SAAS,CAAC;AAAA,MACd;AAAA,IACF,CAAC,GAAG,SAAS;AAAA;AAAA,EAAO,MAAM,KAAK,EAAE;AAAA,EACnC;AACF;AAkBO,UAAU,iBACf,OACkC;AAClC,aAAW,QAAQ,OAAO;AACxB,UAAM;AAAA,EACR;AACF;AAcO,SAAS,SAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AACF,GAAkC;AAChC,SAAO,IAAI;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,iBAAiB,MAAM,SAAS,CAAC;AAAA,IACvC;AAAA,EACF;AACF;AAcO,SAAS,iBACd,OACA,QACA,QACA,SAAS,IACT;AACA,MAAI;AACF,WAAO,OAAO,OAAO,MAAM;AAAA,EAC7B,SAAS,OAAO;AACd,QAAI,iBAAiB,aAAa;AAChC,YAAM,SAAS,EAAE,QAAQ,QAAQ,QAAQ,MAAM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,EAC7B,CAAC;AAED,QAAM,CAAC,QAAQ,IAAI,SAAS,OAAO,KAAK,EAAE,OAAO,CAAC;AAClD,MAAI,UAAU;AACZ,UAAM,IAAI;AAAA,MACR,wBAAwB,KAAK,SAAS,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,IAC5D;AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} +\ No newline at end of file +diff --git a/dist/types/structs.d.ts b/dist/types/structs.d.ts +index 48ebab12dbfe4f157a857f7628a876eeace8024b..23aba5966fd09e89eca5e93375e82621cca76f48 100644 +--- a/dist/types/structs.d.ts ++++ b/dist/types/structs.d.ts +@@ -1,6 +1,5 @@ +-import type { Failure } from 'superstruct'; ++import type { AnyStruct, Failure } from 'superstruct'; + import { Struct, StructError } from 'superstruct'; +-import type { AnyStruct } from 'superstruct/dist/utils'; + /** + * Infer a struct type, only if it matches the specified type. This is useful + * for defining types and structs that are related to each other in separate diff --git a/package.json b/package.json index 294ac4ede5..bb9e7566cb 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,11 @@ "@metamask/snaps-utils@^7.0.3": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", "@metamask/snaps-utils@^7.3.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", + "@metamask/snaps-utils@^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch", + "@metamask/snaps-utils@^7.4.1": "patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch", "@metamask/utils": "8.5.0", - "superstruct": "github:MetaMask/superstruct#v3.1.0" + "superstruct": "github:MetaMask/superstruct#v3.1.0", + "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { "@babel/core": "^7.23.5", diff --git a/yarn.lock b/yarn.lock index 86dd9abc43..1f3d618cd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -603,163 +603,163 @@ __metadata: languageName: node linkType: hard -"@esbuild/aix-ppc64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/aix-ppc64@npm:0.21.5" +"@esbuild/aix-ppc64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/aix-ppc64@npm:0.19.12" conditions: os=aix & cpu=ppc64 languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-arm64@npm:0.21.5" +"@esbuild/android-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-arm64@npm:0.19.12" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@esbuild/android-arm@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-arm@npm:0.21.5" +"@esbuild/android-arm@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-arm@npm:0.19.12" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/android-x64@npm:0.21.5" +"@esbuild/android-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-x64@npm:0.19.12" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/darwin-arm64@npm:0.21.5" +"@esbuild/darwin-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/darwin-arm64@npm:0.19.12" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/darwin-x64@npm:0.21.5" +"@esbuild/darwin-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/darwin-x64@npm:0.19.12" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/freebsd-arm64@npm:0.21.5" +"@esbuild/freebsd-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/freebsd-arm64@npm:0.19.12" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/freebsd-x64@npm:0.21.5" +"@esbuild/freebsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/freebsd-x64@npm:0.19.12" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-arm64@npm:0.21.5" +"@esbuild/linux-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-arm64@npm:0.19.12" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-arm@npm:0.21.5" +"@esbuild/linux-arm@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-arm@npm:0.19.12" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-ia32@npm:0.21.5" +"@esbuild/linux-ia32@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-ia32@npm:0.19.12" conditions: os=linux & cpu=ia32 languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-loong64@npm:0.21.5" +"@esbuild/linux-loong64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-loong64@npm:0.19.12" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-mips64el@npm:0.21.5" +"@esbuild/linux-mips64el@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-mips64el@npm:0.19.12" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-ppc64@npm:0.21.5" +"@esbuild/linux-ppc64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-ppc64@npm:0.19.12" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-riscv64@npm:0.21.5" +"@esbuild/linux-riscv64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-riscv64@npm:0.19.12" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-s390x@npm:0.21.5" +"@esbuild/linux-s390x@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-s390x@npm:0.19.12" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/linux-x64@npm:0.21.5" +"@esbuild/linux-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-x64@npm:0.19.12" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/netbsd-x64@npm:0.21.5" +"@esbuild/netbsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/netbsd-x64@npm:0.19.12" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/openbsd-x64@npm:0.21.5" +"@esbuild/openbsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/openbsd-x64@npm:0.19.12" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/sunos-x64@npm:0.21.5" +"@esbuild/sunos-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/sunos-x64@npm:0.19.12" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-arm64@npm:0.21.5" +"@esbuild/win32-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-arm64@npm:0.19.12" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-ia32@npm:0.21.5" +"@esbuild/win32-ia32@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-ia32@npm:0.19.12" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.21.5": - version: 0.21.5 - resolution: "@esbuild/win32-x64@npm:0.21.5" +"@esbuild/win32-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-x64@npm:0.19.12" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -3775,7 +3775,37 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0": +"@metamask/snaps-utils@npm:7.4.1": + version: 7.4.1 + resolution: "@metamask/snaps-utils@npm:7.4.1" + dependencies: + "@babel/core": ^7.23.2 + "@babel/types": ^7.23.0 + "@metamask/base-controller": ^5.0.2 + "@metamask/key-tree": ^9.1.1 + "@metamask/permission-controller": ^9.0.2 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/slip44": ^3.1.0 + "@metamask/snaps-registry": ^3.1.0 + "@metamask/snaps-sdk": ^4.4.1 + "@metamask/utils": ^8.3.0 + "@noble/hashes": ^1.3.1 + "@scure/base": ^1.1.1 + chalk: ^4.1.2 + cron-parser: ^4.5.0 + fast-deep-equal: ^3.1.3 + fast-json-stable-stringify: ^2.1.0 + marked: ^12.0.1 + rfdc: ^1.3.0 + semver: ^7.5.4 + ses: ^1.1.0 + superstruct: ^1.0.3 + validate-npm-package-name: ^5.0.0 + checksum: d1d6d3c769c33df88fb6e4fc852cdfe1e400b25b1cae020e729f1bfe8a094804cf901700afbbf1372cc1e95f697127b5847bf3a85b46b403ba2ae64ee5750d22 + languageName: node + linkType: hard + +"@metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0": version: 7.7.0 resolution: "@metamask/snaps-utils@npm:7.7.0" dependencies: @@ -3806,9 +3836,9 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils@npm:^7.4.1": +"@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": version: 7.4.1 - resolution: "@metamask/snaps-utils@npm:7.4.1" + resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch::version=7.4.1&hash=f624f8&locator=%40metamask%2Fcore-monorepo%40workspace%3A." dependencies: "@babel/core": ^7.23.2 "@babel/types": ^7.23.0 @@ -3832,7 +3862,7 @@ __metadata: ses: ^1.1.0 superstruct: ^1.0.3 validate-npm-package-name: ^5.0.0 - checksum: d1d6d3c769c33df88fb6e4fc852cdfe1e400b25b1cae020e729f1bfe8a094804cf901700afbbf1372cc1e95f697127b5847bf3a85b46b403ba2ae64ee5750d22 + checksum: 96811889938b893bc4d8545ad90109b2cbaa0cb1c66937b75a7f37ade3305bb0f216aa512697bbabf8b565eff59136a6f895b7519ae0b4e5d74f8ac027bf4a41 languageName: node linkType: hard @@ -6868,33 +6898,33 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.21.4": - version: 0.21.5 - resolution: "esbuild@npm:0.21.5" - dependencies: - "@esbuild/aix-ppc64": 0.21.5 - "@esbuild/android-arm": 0.21.5 - "@esbuild/android-arm64": 0.21.5 - "@esbuild/android-x64": 0.21.5 - "@esbuild/darwin-arm64": 0.21.5 - "@esbuild/darwin-x64": 0.21.5 - "@esbuild/freebsd-arm64": 0.21.5 - "@esbuild/freebsd-x64": 0.21.5 - "@esbuild/linux-arm": 0.21.5 - "@esbuild/linux-arm64": 0.21.5 - "@esbuild/linux-ia32": 0.21.5 - "@esbuild/linux-loong64": 0.21.5 - "@esbuild/linux-mips64el": 0.21.5 - "@esbuild/linux-ppc64": 0.21.5 - "@esbuild/linux-riscv64": 0.21.5 - "@esbuild/linux-s390x": 0.21.5 - "@esbuild/linux-x64": 0.21.5 - "@esbuild/netbsd-x64": 0.21.5 - "@esbuild/openbsd-x64": 0.21.5 - "@esbuild/sunos-x64": 0.21.5 - "@esbuild/win32-arm64": 0.21.5 - "@esbuild/win32-ia32": 0.21.5 - "@esbuild/win32-x64": 0.21.5 +"esbuild@npm:^0.19.2": + version: 0.19.12 + resolution: "esbuild@npm:0.19.12" + dependencies: + "@esbuild/aix-ppc64": 0.19.12 + "@esbuild/android-arm": 0.19.12 + "@esbuild/android-arm64": 0.19.12 + "@esbuild/android-x64": 0.19.12 + "@esbuild/darwin-arm64": 0.19.12 + "@esbuild/darwin-x64": 0.19.12 + "@esbuild/freebsd-arm64": 0.19.12 + "@esbuild/freebsd-x64": 0.19.12 + "@esbuild/linux-arm": 0.19.12 + "@esbuild/linux-arm64": 0.19.12 + "@esbuild/linux-ia32": 0.19.12 + "@esbuild/linux-loong64": 0.19.12 + "@esbuild/linux-mips64el": 0.19.12 + "@esbuild/linux-ppc64": 0.19.12 + "@esbuild/linux-riscv64": 0.19.12 + "@esbuild/linux-s390x": 0.19.12 + "@esbuild/linux-x64": 0.19.12 + "@esbuild/netbsd-x64": 0.19.12 + "@esbuild/openbsd-x64": 0.19.12 + "@esbuild/sunos-x64": 0.19.12 + "@esbuild/win32-arm64": 0.19.12 + "@esbuild/win32-ia32": 0.19.12 + "@esbuild/win32-x64": 0.19.12 dependenciesMeta: "@esbuild/aix-ppc64": optional: true @@ -6944,7 +6974,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 2911c7b50b23a9df59a7d6d4cdd3a4f85855787f374dce751148dbb13305e0ce7e880dde1608c2ab7a927fc6cec3587b80995f7fc87a64b455f8b70b55fd8ec1 + checksum: 2936e29107b43e65a775b78b7bc66ddd7d76febd73840ac7e825fb22b65029422ff51038a08d19b05154f543584bd3afe7d1ef1c63900429475b17fbe61cb61f languageName: node linkType: hard @@ -12614,15 +12644,54 @@ __metadata: languageName: node linkType: hard -"tsup@npm:^8.0.2": - version: 8.1.0 - resolution: "tsup@npm:8.1.0" +"tsup@npm:8.0.2": + version: 8.0.2 + resolution: "tsup@npm:8.0.2" + dependencies: + bundle-require: ^4.0.0 + cac: ^6.7.12 + chokidar: ^3.5.1 + debug: ^4.3.1 + esbuild: ^0.19.2 + execa: ^5.0.0 + globby: ^11.0.3 + joycon: ^3.0.1 + postcss-load-config: ^4.0.1 + resolve-from: ^5.0.0 + rollup: ^4.0.2 + source-map: 0.8.0-beta.0 + sucrase: ^3.20.3 + tree-kill: ^1.2.2 + peerDependencies: + "@microsoft/api-extractor": ^7.36.0 + "@swc/core": ^1 + postcss: ^8.4.12 + typescript: ">=4.5.0" + peerDependenciesMeta: + "@microsoft/api-extractor": + optional: true + "@swc/core": + optional: true + postcss: + optional: true + typescript: + optional: true + bin: + tsup: dist/cli-default.js + tsup-node: dist/cli-node.js + checksum: ebd0c662efdc2a04e80251aa11832d3def9cf3bf120c579975af6d50183fa0397d07d5bcee0688258a91c154a3c5db72ee4c5dca367b58552d225bc8a89d67d0 + languageName: node + linkType: hard + +"tsup@patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": + version: 8.0.2 + resolution: "tsup@patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch::version=8.0.2&hash=ce4dd6&locator=%40metamask%2Fcore-monorepo%40workspace%3A." dependencies: bundle-require: ^4.0.0 cac: ^6.7.12 chokidar: ^3.5.1 debug: ^4.3.1 - esbuild: ^0.21.4 + esbuild: ^0.19.2 execa: ^5.0.0 globby: ^11.0.3 joycon: ^3.0.1 @@ -12649,7 +12718,7 @@ __metadata: bin: tsup: dist/cli-default.js tsup-node: dist/cli-node.js - checksum: 15b759e01313f62edbf6900de547ba2942e15c49b3b699bafe0e544530072a548c0e52799861c2ff7322a1c2454dd013ace55695d5e95e8987e6003f28e9b0c0 + checksum: 69cb678c075a49a4285c61ece6f70016b0c7ba7e2a958e95bce1a79b63b631563fef6b689a6729cdc0f59fcd40c99c2aac18bd14395c656d35182d670ec259bf languageName: node linkType: hard From dc29903c720b018c1c4ba1a2fec7c5da61fec42b Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:17:48 -0400 Subject: [PATCH 18/47] Update yarn resolutions for dependencies affected by `superstruct` issue --- package.json | 20 ++-- yarn.lock | 255 +++++++++++---------------------------------------- 2 files changed, 60 insertions(+), 215 deletions(-) diff --git a/package.json b/package.json index bb9e7566cb..d85c896882 100644 --- a/package.json +++ b/package.json @@ -43,20 +43,12 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/keyring-api@^6.3.1": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", - "@metamask/keyring-api@^6.4.0": "patch:@metamask/keyring-api@npm%3A6.4.0#./.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch", - "@metamask/snaps-sdk@^4.0.0": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", - "@metamask/snaps-sdk@^4.0.1": "patch:@metamask/snaps-sdk@npm%3A4.2.0#./.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch", - "@metamask/snaps-sdk@^4.1.0": "patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch", - "@metamask/snaps-sdk@^4.2.0": "patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch", - "@metamask/snaps-sdk@^4.4.1": "patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch", - "@metamask/snaps-utils@^7.0.3": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", - "@metamask/snaps-utils@^7.1.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", - "@metamask/snaps-utils@^7.3.0": "patch:@metamask/snaps-utils@npm%3A7.4.0#./.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch", - "@metamask/snaps-utils@^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch", - "@metamask/snaps-utils@^7.4.1": "patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch", - "@metamask/utils": "8.5.0", - "superstruct": "github:MetaMask/superstruct#v3.1.0", + "@metamask/abi-utils": "github:MetaMask/abi-utils#release/2.0.3", + "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", + "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", + "@metamask/snaps-registry": "github:MetaMask/snaps-registry#release/3.2.0", + "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", + "superstruct": "github:MetaMask/superstruct#v3.0.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 1f3d618cd4..8c80de7f50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2183,13 +2183,13 @@ __metadata: languageName: node linkType: hard -"@metamask/abi-utils@npm:^2.0.2": +"@metamask/abi-utils@github:MetaMask/abi-utils#release/2.0.3": version: 2.0.3 - resolution: "@metamask/abi-utils@npm:2.0.3" + resolution: "@metamask/abi-utils@https://github.com/MetaMask/abi-utils.git#commit=f77d095b0f47c6dfc8956e951215225edc110bb0" dependencies: "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.5.0 - checksum: c0d43cd52a6615b32b09ed6786d01e3de764af30b107941a5df134f8a48da344793035dd247f5b38a56f36c436c7131b94b0c71ef004e88e6e00f878ffa4ebbf + checksum: c6f0c9ca55a481751efbe6b1588fbf3df76c48cc78a046fe11b33239abb12fa85c91566894158aa2d9d9eee2f2f3fc516463227b2603254feb17e591a38d4500 languageName: node linkType: hard @@ -2823,9 +2823,9 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-snap-keyring@npm:^4.3.1": - version: 4.3.1 - resolution: "@metamask/eth-snap-keyring@npm:4.3.1" +"@metamask/eth-snap-keyring@github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork": + version: 4.3.0 + resolution: "@metamask/eth-snap-keyring@https://github.com/MetaMask/eth-snap-keyring.git#commit=d97cc2380e13f5ba441bc46ce3760a0ec0053456" dependencies: "@ethereumjs/tx": ^4.2.0 "@metamask/eth-sig-util": ^7.0.1 @@ -2833,11 +2833,11 @@ __metadata: "@metamask/snaps-controllers": ^8.1.1 "@metamask/snaps-sdk": ^4.2.0 "@metamask/snaps-utils": ^7.4.0 - "@metamask/utils": ^8.4.0 + "@metamask/superstruct": ^3.0.0 + "@metamask/utils": ^8.5.0 "@types/uuid": ^9.0.1 - superstruct: ^1.0.3 uuid: ^9.0.0 - checksum: 9964e08cc000492c20d09c16638d4116a9495ea70105c3f34d8a08d549ec88a625b7fe3b96ce3060f416ed34dad33b7ea73f22961f4e442cab3b3f50ef05c721 + checksum: 97fae1978132060e1c359b1100100d99703fd1c39a6e69a5dd1ce179a99478713331a22dcd824f98086b9fb8491ad1ba7ab6dcecfd1a9020303dd9c9d7f264ae languageName: node linkType: hard @@ -3013,7 +3013,19 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@^8.0.0, @metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": +"@metamask/json-rpc-middleware-stream@npm:^7.0.1": + version: 7.0.2 + resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.2" + dependencies: + "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^8.3.0 + readable-stream: ^3.6.2 + checksum: ff11ad3ff0ec27530efc53c4e6543661648f437dacdd58797449307e20dbc428b479cd8d1e9767797268b98d0445bd6f1986820a8c855faeef01d5c03b55323b + languageName: node + linkType: hard + +"@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": version: 0.0.0-use.local resolution: "@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream" dependencies: @@ -3036,18 +3048,6 @@ __metadata: languageName: unknown linkType: soft -"@metamask/json-rpc-middleware-stream@npm:^7.0.1": - version: 7.0.2 - resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.2" - dependencies: - "@metamask/json-rpc-engine": ^8.0.2 - "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 - readable-stream: ^3.6.2 - checksum: ff11ad3ff0ec27530efc53c4e6543661648f437dacdd58797449307e20dbc428b479cd8d1e9767797268b98d0445bd6f1986820a8c855faeef01d5c03b55323b - languageName: node - linkType: hard - "@metamask/key-tree@npm:^9.1.1": version: 9.1.1 resolution: "@metamask/key-tree@npm:9.1.1" @@ -3061,19 +3061,19 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-api@npm:^8.0.0": +"@metamask/keyring-api@github:MetaMask/keyring-api#replace-superstruct-with-fork": version: 8.0.0 - resolution: "@metamask/keyring-api@npm:8.0.0" + resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=09f8f6ba9db00d8495066fe2be1dd8b624035a5c" dependencies: - "@metamask/snaps-sdk": ^4.2.0 - "@metamask/utils": ^8.4.0 + "@metamask/snaps-sdk": ^4.4.2 + "@metamask/superstruct": ^3.0.0 + "@metamask/utils": ^8.5.0 "@types/uuid": ^9.0.8 bech32: ^2.0.0 - superstruct: ^1.0.3 uuid: ^9.0.1 peerDependencies: "@metamask/providers": ">=15 <18" - checksum: 945d4bdb69d2eea60bd990d6372a7b8e5740a1c7aa66361ad1fa309273f05ec0543edea84524ed266e8e06a38fd4727869da646306682e5fa0d52c8ccc393c4a + checksum: ab3ac7f519852ef175f6c151c0c43bf0c32bf5f1f87af8aac8e5d8a762279c5b5b3542ea1a78a44cb5946ef8d07ec766becf701652047f5889f4a46afa816932 languageName: node linkType: hard @@ -3496,27 +3496,6 @@ __metadata: languageName: unknown linkType: soft -"@metamask/providers@npm:^17.0.0": - version: 17.1.0 - resolution: "@metamask/providers@npm:17.1.0" - dependencies: - "@metamask/json-rpc-engine": ^9.0.0 - "@metamask/json-rpc-middleware-stream": ^8.0.0 - "@metamask/object-multiplex": ^2.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/safe-event-emitter": ^3.1.1 - "@metamask/utils": ^8.3.0 - detect-browser: ^5.2.0 - extension-port-stream: ^4.1.0 - fast-deep-equal: ^3.1.3 - is-stream: ^2.0.0 - readable-stream: ^3.6.2 - peerDependencies: - webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 1378f7e9a5385536e814190f880cd71bbb0a055b8a234012243ba9f54c5eace1d8bb5324732cb46b3046ad22349a698c1ca3c06402e52675b66e55b9b741f820 - languageName: node - linkType: hard - "@metamask/queued-request-controller@workspace:packages/queued-request-controller": version: 0.0.0-use.local resolution: "@metamask/queued-request-controller@workspace:packages/queued-request-controller" @@ -3575,7 +3554,7 @@ __metadata: languageName: node linkType: hard -"@metamask/safe-event-emitter@npm:^3.0.0, @metamask/safe-event-emitter@npm:^3.1.1": +"@metamask/safe-event-emitter@npm:^3.0.0": version: 3.1.1 resolution: "@metamask/safe-event-emitter@npm:3.1.1" checksum: e24db4d7c20764bfc5b025065f92518c805f0ffb1da4820078b8cff7dcae964c0f354cf053fcb7ac659de015d5ffdf21aae5e8d44e191ee8faa9066855f22653 @@ -3692,15 +3671,15 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.1.0": +"@metamask/snaps-registry@github:MetaMask/snaps-registry#release/3.2.0": version: 3.2.0 - resolution: "@metamask/snaps-registry@npm:3.2.0" + resolution: "@metamask/snaps-registry@https://github.com/MetaMask/snaps-registry.git#commit=3edbb5a1e747e8bccca185447691485f471f7a6c" dependencies: "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.5.0 "@noble/curves": ^1.2.0 "@noble/hashes": ^1.3.2 - checksum: ac3537cda6454f461e6d00623aefa29ee3e7f7c68003c7629fc550c1f27694115c475d626c89172bd7ecb52de2a0b75db64aa9fe9e8625492e335337d3f579f7 + checksum: 6e2c9778a4bf7f82c0e47b593f2d9930fcd0d1388358b7428acf8bf2d18c25109b2db035e2083a0fd9df9b13eb643b324cb3ec65698a43d3b3b13fd68c5fbf55 languageName: node linkType: hard @@ -3720,92 +3699,14 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@npm:4.4.1": - version: 4.4.1 - resolution: "@metamask/snaps-sdk@npm:4.4.1" - dependencies: - "@metamask/key-tree": ^9.1.1 - "@metamask/providers": ^17.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 - fast-xml-parser: ^4.3.4 - superstruct: ^1.0.3 - checksum: 29dfc36821e77d033ddc1b8f1b8924b4880aca41a25e1767741b50659990a79d3026f3975613090342e98d0cf8d876a0e003edb23ff39d2927dc6473d5c441f9 - languageName: node - linkType: hard - -"@metamask/snaps-sdk@npm:^4.4.2": - version: 4.4.2 - resolution: "@metamask/snaps-sdk@npm:4.4.2" - dependencies: - "@metamask/key-tree": ^9.1.1 - "@metamask/providers": ^17.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 - fast-xml-parser: ^4.3.4 - superstruct: ^1.0.3 - checksum: 2ff3949cee3b6c5a580304a02191f3ec7fb049460c2ff89b1731f24b215baf5f9c08834a0b2b703ff43e3b74ede387386e22a96810b50be106bb029b180c44ce +"@metamask/snaps-sdk@github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk": + version: 53.0.0 + resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#branch=replace-superstruct-with-fork%23workspace%3D%40metamask%2Fsnaps-sdk&commit=26bbd2abab70607370d9d32b89af26123bd20c9d" + checksum: cc44f25cb0d3b1d09986ebcac96308479972d1ad337f61cdca183d813afe7af4baf0ba99365e67a8581bcd22a2ab615d3912b69d378231f5bc4fdd6845ceaf66 languageName: node linkType: hard -"@metamask/snaps-sdk@npm:^6.0.0": - version: 6.0.0 - resolution: "@metamask/snaps-sdk@npm:6.0.0" - dependencies: - "@metamask/key-tree": ^9.1.1 - "@metamask/providers": ^17.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 - superstruct: ^1.0.3 - checksum: 0a3b7a034028a7583b4e1a5414a67470b2ed70cc411fc4877a79f95803c64d99eafb785cbffaf827c3f3138a065e439480b9628456a8a5fa8d39c9c8dd9bd5db - languageName: node - linkType: hard - -"@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": - version: 4.4.1 - resolution: "@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A4.4.1#./.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch::version=4.4.1&hash=d41693&locator=%40metamask%2Fcore-monorepo%40workspace%3A." - dependencies: - "@metamask/key-tree": ^9.1.1 - "@metamask/providers": ^17.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 - fast-xml-parser: ^4.3.4 - superstruct: ^1.0.3 - checksum: 332ee26fb8eac652f403defa0c65bc2b4339f6e6d1fdb49b54d38db6ffbe3c29442faa20f48675c36342cba647e827f360fe508bc6bdcc359d82c7dc70ef8a20 - languageName: node - linkType: hard - -"@metamask/snaps-utils@npm:7.4.1": - version: 7.4.1 - resolution: "@metamask/snaps-utils@npm:7.4.1" - dependencies: - "@babel/core": ^7.23.2 - "@babel/types": ^7.23.0 - "@metamask/base-controller": ^5.0.2 - "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^9.0.2 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/slip44": ^3.1.0 - "@metamask/snaps-registry": ^3.1.0 - "@metamask/snaps-sdk": ^4.4.1 - "@metamask/utils": ^8.3.0 - "@noble/hashes": ^1.3.1 - "@scure/base": ^1.1.1 - chalk: ^4.1.2 - cron-parser: ^4.5.0 - fast-deep-equal: ^3.1.3 - fast-json-stable-stringify: ^2.1.0 - marked: ^12.0.1 - rfdc: ^1.3.0 - semver: ^7.5.4 - ses: ^1.1.0 - superstruct: ^1.0.3 - validate-npm-package-name: ^5.0.0 - checksum: d1d6d3c769c33df88fb6e4fc852cdfe1e400b25b1cae020e729f1bfe8a094804cf901700afbbf1372cc1e95f697127b5847bf3a85b46b403ba2ae64ee5750d22 - languageName: node - linkType: hard - -"@metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0": +"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.4.1, @metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0": version: 7.7.0 resolution: "@metamask/snaps-utils@npm:7.7.0" dependencies: @@ -3836,36 +3737,6 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch::locator=%40metamask%2Fcore-monorepo%40workspace%3A.": - version: 7.4.1 - resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.4.1#./.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch::version=7.4.1&hash=f624f8&locator=%40metamask%2Fcore-monorepo%40workspace%3A." - dependencies: - "@babel/core": ^7.23.2 - "@babel/types": ^7.23.0 - "@metamask/base-controller": ^5.0.2 - "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^9.0.2 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/slip44": ^3.1.0 - "@metamask/snaps-registry": ^3.1.0 - "@metamask/snaps-sdk": ^4.4.1 - "@metamask/utils": ^8.3.0 - "@noble/hashes": ^1.3.1 - "@scure/base": ^1.1.1 - chalk: ^4.1.2 - cron-parser: ^4.5.0 - fast-deep-equal: ^3.1.3 - fast-json-stable-stringify: ^2.1.0 - marked: ^12.0.1 - rfdc: ^1.3.0 - semver: ^7.5.4 - ses: ^1.1.0 - superstruct: ^1.0.3 - validate-npm-package-name: ^5.0.0 - checksum: 96811889938b893bc4d8545ad90109b2cbaa0cb1c66937b75a7f37ade3305bb0f216aa512697bbabf8b565eff59136a6f895b7519ae0b4e5d74f8ac027bf4a41 - languageName: node - linkType: hard - "@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" @@ -3970,7 +3841,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:8.5.0": +"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0, @metamask/utils@npm:^8.5.0": version: 8.5.0 resolution: "@metamask/utils@npm:8.5.0" dependencies: @@ -4689,9 +4560,9 @@ __metadata: linkType: hard "@types/lodash@npm:^4.14.191": - version: 4.17.6 - resolution: "@types/lodash@npm:4.17.6" - checksum: f748c672f49c54ee631a0fab6f26d56ab99bd68a4fb91604b5d7525a72102dd1917209c12d7078c988a375edb5dc70ca600db05ac01785306fd64470048cd16c + version: 4.17.5 + resolution: "@types/lodash@npm:4.17.5" + checksum: 3c9bb15772509f0ecb40428531863dbc3f064f2bf34bbccc2ce2b2923c69fb0868aec7e357b1d97fd0d7f7e435a014ea5c1adef8a64715529887179c97a5a823 languageName: node linkType: hard @@ -5935,9 +5806,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001629": - version: 1.0.30001638 - resolution: "caniuse-lite@npm:1.0.30001638" - checksum: 82e47b2bfac107c662e03bfd3321bfd9493f87240c77a9bfba7ea2cc9e0b81d9238152aed903fb19e60557879e4f48b57e2c6300677391b92a060fbf0a340e30 + version: 1.0.30001636 + resolution: "caniuse-lite@npm:1.0.30001636" + checksum: b0347fd2c8d346680a64d98b061c59cb8fbf149cdd03005a447fae4d21e6286d5bd161b43eefe3221c6624aacb3cda4e838ae83c95ff5313a547f84ca93bcc70 languageName: node linkType: hard @@ -6575,13 +6446,6 @@ __metadata: languageName: node linkType: hard -"detect-browser@npm:^5.2.0": - version: 5.3.0 - resolution: "detect-browser@npm:5.3.0" - checksum: dd6e08d55da1d9e0f22510ac79872078ae03d9dfa13c5e66c96baedc1c86567345a88f96949161f6be8f3e0fafa93bf179bdb1cd311b14f5f163112fcc70ab49 - languageName: node - linkType: hard - "detect-file@npm:^1.0.0": version: 1.0.0 resolution: "detect-file@npm:1.0.0" @@ -6682,9 +6546,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.4.796": - version: 1.4.812 - resolution: "electron-to-chromium@npm:1.4.812" - checksum: 0205fcb6db3a719873398f46cd3341188d4a54e056567453819532c5fd1fadda43f501c252bc8d05eeaaeb1497f58d9875c46c4f9ecfbe713b9efe71cd879b13 + version: 1.4.811 + resolution: "electron-to-chromium@npm:1.4.811" + checksum: 59eb33e5c3836278375cb8ae77d1da08343c871af67a6acc4033ac4a45095af80ba74d3f78a790cd3be3ff2ae8b70868e1e88caeaec93ce22f49adbe7afb9992 languageName: node linkType: hard @@ -7649,17 +7513,6 @@ __metadata: languageName: node linkType: hard -"extension-port-stream@npm:^4.1.0": - version: 4.1.0 - resolution: "extension-port-stream@npm:4.1.0" - dependencies: - readable-stream: ^3.6.2 || ^4.4.2 - peerDependencies: - webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: e349277cf65a89c2a6c4f3611f52e0a97497bd2870a4c25aa4ab11b300c48e3013fd95208e3ff6c8494dfb849eed725e7506e59118b1a69e555fa4b67afdbd83 - languageName: node - linkType: hard - "fast-copy@npm:^2.1.7": version: 2.1.7 resolution: "fast-copy@npm:2.1.7" @@ -10578,13 +10431,13 @@ __metadata: linkType: hard "normalize-package-data@npm:^6.0.0": - version: 6.0.2 - resolution: "normalize-package-data@npm:6.0.2" + version: 6.0.1 + resolution: "normalize-package-data@npm:6.0.1" dependencies: hosted-git-info: ^7.0.0 semver: ^7.3.5 validate-npm-package-license: ^3.0.4 - checksum: ea35f8de68e03fc845f545c8197857c0cd256207fdb809ca63c2b39fe76ae77765ee939eb21811fb6c3b533296abf49ebe3cd617064f98a775adaccb24ff2e03 + checksum: 4f6bca00b5092b824e1d4a28fb47052b41afaaebabfd0700e47f130cac619d60668aa6ff34dfa9bccc1b06c7adcef44c34a565576b63b578e1e35b3fc67c22ca languageName: node linkType: hard @@ -12286,10 +12139,10 @@ __metadata: languageName: node linkType: hard -"superstruct@github:MetaMask/superstruct#v3.1.0": - version: 3.1.0 - resolution: "superstruct@https://github.com/MetaMask/superstruct.git#commit=3cd308f6607bc52e2fa0582f4a778f9ed597e25c" - checksum: 85e7fd4c9046a5cf6fa990d6497f26a7e20493d25143f80269e7c950636679f0604e2ea5f0bcbea78c7351072905ba8998ff2f2ba8e6c4750852fbc58ed82247 +"superstruct@github:MetaMask/superstruct#v3.0.0": + version: 3.0.0 + resolution: "superstruct@https://github.com/MetaMask/superstruct.git#commit=4a2a7b0a77fdb364be6fbdda4c1c8596d24d2dd0" + checksum: b91ffedbddb4794bf7f1616323b22c922dc5c021f2594bbe936255ded359ce0df7d8c80a4f94b97fac37080356f900b80b097932a9d3060b0577101345cedb81 languageName: node linkType: hard From ac77a7b9e18cbb24fefbefdfa50d899416eaf342 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:18:50 -0400 Subject: [PATCH 19/47] Bump `@metamask/utils` from `^8.3.0` to `^8.5.0` in all packages --- package.json | 2 +- packages/accounts-controller/package.json | 2 +- packages/address-book-controller/package.json | 2 +- packages/approval-controller/package.json | 2 +- packages/assets-controllers/package.json | 2 +- packages/base-controller/package.json | 2 +- packages/build-utils/package.json | 2 +- packages/chain-controller/package.json | 2 +- packages/controller-utils/package.json | 2 +- packages/ens-controller/package.json | 2 +- packages/eth-json-rpc-provider/package.json | 2 +- packages/gas-fee-controller/package.json | 2 +- packages/json-rpc-engine/package.json | 2 +- .../json-rpc-middleware-stream/package.json | 2 +- packages/keyring-controller/package.json | 2 +- packages/message-manager/package.json | 2 +- packages/name-controller/package.json | 2 +- packages/network-controller/package.json | 2 +- packages/notification-controller/package.json | 2 +- packages/permission-controller/package.json | 2 +- .../permission-log-controller/package.json | 2 +- packages/polling-controller/package.json | 2 +- .../queued-request-controller/package.json | 2 +- packages/rate-limit-controller/package.json | 2 +- .../selected-network-controller/package.json | 2 +- packages/signature-controller/package.json | 2 +- packages/transaction-controller/package.json | 2 +- .../user-operation-controller/package.json | 2 +- yarn.lock | 56 +++++++++---------- 29 files changed, 56 insertions(+), 56 deletions(-) diff --git a/package.json b/package.json index d85c896882..5ebfe73288 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@metamask/eth-block-tracker": "^9.0.3", "@metamask/eth-json-rpc-provider": "^4.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/jest": "^27.4.1", "@types/node": "^16.18.54", "@typescript-eslint/eslint-plugin": "^5.62.0", diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index b8ed61400e..6680a79504 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -48,7 +48,7 @@ "@metamask/keyring-controller": "^17.1.0", "@metamask/snaps-sdk": "^4.4.1", "@metamask/snaps-utils": "^7.4.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "deepmerge": "^4.2.2", "ethereum-cryptography": "^2.1.2", "immer": "^9.0.6", diff --git a/packages/address-book-controller/package.json b/packages/address-book-controller/package.json index 378dd40d42..1a8dfd9380 100644 --- a/packages/address-book-controller/package.json +++ b/packages/address-book-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/approval-controller/package.json b/packages/approval-controller/package.json index ea0a0a792e..2172147d30 100644 --- a/packages/approval-controller/package.json +++ b/packages/approval-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "nanoid": "^3.1.31" }, "devDependencies": { diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index c025bebb5d..f4a6a7dded 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -59,7 +59,7 @@ "@metamask/polling-controller": "^8.0.0", "@metamask/preferences-controller": "^13.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", "async-mutex": "^0.5.0", diff --git a/packages/base-controller/package.json b/packages/base-controller/package.json index dc7cc561e7..ae15ca7238 100644 --- a/packages/base-controller/package.json +++ b/packages/base-controller/package.json @@ -40,7 +40,7 @@ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "immer": "^9.0.6" }, "devDependencies": { diff --git a/packages/build-utils/package.json b/packages/build-utils/package.json index db094021ab..ba5a540d43 100644 --- a/packages/build-utils/package.json +++ b/packages/build-utils/package.json @@ -41,7 +41,7 @@ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/eslint": "^8.44.7" }, "devDependencies": { diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index b75ae7fdbe..7f3bfd8ddb 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -47,7 +47,7 @@ "@metamask/snaps-controllers": "^8.1.1", "@metamask/snaps-sdk": "^4.4.1", "@metamask/snaps-utils": "^7.4.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/packages/controller-utils/package.json b/packages/controller-utils/package.json index 176bef5c90..45dfdd7fd9 100644 --- a/packages/controller-utils/package.json +++ b/packages/controller-utils/package.json @@ -44,7 +44,7 @@ "@ethereumjs/util": "^8.1.0", "@metamask/eth-query": "^4.0.0", "@metamask/ethjs-unit": "^0.3.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@spruceid/siwe-parser": "2.1.0", "@types/bn.js": "^5.1.5", "bn.js": "^5.2.1", diff --git a/packages/ens-controller/package.json b/packages/ens-controller/package.json index d2c531895b..1424f1d3c2 100644 --- a/packages/ens-controller/package.json +++ b/packages/ens-controller/package.json @@ -44,7 +44,7 @@ "@ethersproject/providers": "^5.7.0", "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "punycode": "^2.1.1" }, "devDependencies": { diff --git a/packages/eth-json-rpc-provider/package.json b/packages/eth-json-rpc-provider/package.json index 65c6ed89c4..e40b4c7a86 100644 --- a/packages/eth-json-rpc-provider/package.json +++ b/packages/eth-json-rpc-provider/package.json @@ -48,7 +48,7 @@ "dependencies": { "@metamask/json-rpc-engine": "^9.0.0", "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/gas-fee-controller/package.json b/packages/gas-fee-controller/package.json index 3b1847390e..ee49381a1e 100644 --- a/packages/gas-fee-controller/package.json +++ b/packages/gas-fee-controller/package.json @@ -47,7 +47,7 @@ "@metamask/ethjs-unit": "^0.3.0", "@metamask/network-controller": "^19.0.0", "@metamask/polling-controller": "^8.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", "bn.js": "^5.2.1", diff --git a/packages/json-rpc-engine/package.json b/packages/json-rpc-engine/package.json index 953ea6d656..bb35e6f1fd 100644 --- a/packages/json-rpc-engine/package.json +++ b/packages/json-rpc-engine/package.json @@ -52,7 +52,7 @@ "dependencies": { "@metamask/rpc-errors": "^6.2.1", "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/json-rpc-middleware-stream/package.json b/packages/json-rpc-middleware-stream/package.json index 9a8d06145e..d30e464aff 100644 --- a/packages/json-rpc-middleware-stream/package.json +++ b/packages/json-rpc-middleware-stream/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/json-rpc-engine": "^9.0.0", "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "readable-stream": "^3.6.2" }, "devDependencies": { diff --git a/packages/keyring-controller/package.json b/packages/keyring-controller/package.json index d52b56fbd6..68b36dbe24 100644 --- a/packages/keyring-controller/package.json +++ b/packages/keyring-controller/package.json @@ -50,7 +50,7 @@ "@metamask/eth-simple-keyring": "^6.0.1", "@metamask/keyring-api": "^8.0.0", "@metamask/message-manager": "^10.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "async-mutex": "^0.5.0", "ethereumjs-wallet": "^1.0.1", "immer": "^9.0.6" diff --git a/packages/message-manager/package.json b/packages/message-manager/package.json index a33349b6d8..b6f8c8fc6d 100644 --- a/packages/message-manager/package.json +++ b/packages/message-manager/package.json @@ -44,7 +44,7 @@ "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", "@metamask/eth-sig-util": "^7.0.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/uuid": "^8.3.0", "jsonschema": "^1.2.4", "uuid": "^8.3.2" diff --git a/packages/name-controller/package.json b/packages/name-controller/package.json index 97ff90f95a..80bfed5751 100644 --- a/packages/name-controller/package.json +++ b/packages/name-controller/package.json @@ -44,7 +44,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "async-mutex": "^0.5.0" }, "devDependencies": { diff --git a/packages/network-controller/package.json b/packages/network-controller/package.json index dd0022c8c5..31cfe7e79c 100644 --- a/packages/network-controller/package.json +++ b/packages/network-controller/package.json @@ -51,7 +51,7 @@ "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/swappable-obj-proxy": "^2.2.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "async-mutex": "^0.5.0", "immer": "^9.0.6", "uuid": "^8.3.2" diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json index fc5b6312f2..dd595204a1 100644 --- a/packages/notification-controller/package.json +++ b/packages/notification-controller/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@metamask/base-controller": "^6.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "nanoid": "^3.1.31" }, "devDependencies": { diff --git a/packages/permission-controller/package.json b/packages/permission-controller/package.json index 81bd0482ee..367ef4f73c 100644 --- a/packages/permission-controller/package.json +++ b/packages/permission-controller/package.json @@ -45,7 +45,7 @@ "@metamask/controller-utils": "^11.0.0", "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/deep-freeze-strict": "^1.1.0", "deep-freeze-strict": "^1.1.1", "immer": "^9.0.6", diff --git a/packages/permission-log-controller/package.json b/packages/permission-log-controller/package.json index 23a7bdc541..064be920db 100644 --- a/packages/permission-log-controller/package.json +++ b/packages/permission-log-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/polling-controller/package.json b/packages/polling-controller/package.json index d316c74034..11d4ad958d 100644 --- a/packages/polling-controller/package.json +++ b/packages/polling-controller/package.json @@ -44,7 +44,7 @@ "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", "@metamask/network-controller": "^19.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@types/uuid": "^8.3.0", "fast-json-stable-stringify": "^2.1.0", "uuid": "^8.3.2" diff --git a/packages/queued-request-controller/package.json b/packages/queued-request-controller/package.json index f3eea3053e..0bcef58ad7 100644 --- a/packages/queued-request-controller/package.json +++ b/packages/queued-request-controller/package.json @@ -46,7 +46,7 @@ "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/swappable-obj-proxy": "^2.2.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/rate-limit-controller/package.json b/packages/rate-limit-controller/package.json index 4046c2ab70..16b60e6d98 100644 --- a/packages/rate-limit-controller/package.json +++ b/packages/rate-limit-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/selected-network-controller/package.json b/packages/selected-network-controller/package.json index d97c61fc16..576900a8c5 100644 --- a/packages/selected-network-controller/package.json +++ b/packages/selected-network-controller/package.json @@ -46,7 +46,7 @@ "@metamask/network-controller": "^19.0.0", "@metamask/permission-controller": "^10.0.0", "@metamask/swappable-obj-proxy": "^2.2.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/signature-controller/package.json b/packages/signature-controller/package.json index e64b5ef26c..d9ede33272 100644 --- a/packages/signature-controller/package.json +++ b/packages/signature-controller/package.json @@ -48,7 +48,7 @@ "@metamask/logging-controller": "^5.0.0", "@metamask/message-manager": "^10.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "lodash": "^4.17.21" }, "devDependencies": { diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index 88a00fa61f..3396f126b3 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -57,7 +57,7 @@ "@metamask/network-controller": "^19.0.0", "@metamask/nonce-tracker": "^5.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "async-mutex": "^0.5.0", "bn.js": "^5.2.1", "eth-method-registry": "^4.0.0", diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index 8ae8f6c339..23df0d4f83 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -53,7 +53,7 @@ "@metamask/rpc-errors": "^6.2.1", "@metamask/superstruct": "^3.1.0", "@metamask/transaction-controller": "^33.0.1", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "bn.js": "^5.2.1", "immer": "^9.0.6", "lodash": "^4.17.21", diff --git a/yarn.lock b/yarn.lock index 8c80de7f50..fb843edbbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2206,7 +2206,7 @@ __metadata: "@metamask/snaps-controllers": ^8.1.1 "@metamask/snaps-sdk": ^4.4.1 "@metamask/snaps-utils": ^7.4.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/readable-stream": ^2.3.0 deepmerge: ^4.2.2 @@ -2242,7 +2242,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 "@metamask/controller-utils": ^11.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -2276,7 +2276,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -2326,7 +2326,7 @@ __metadata: "@metamask/polling-controller": ^8.0.0 "@metamask/preferences-controller": ^13.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/bn.js": ^5.1.5 "@types/jest": ^27.4.1 "@types/lodash": ^4.14.191 @@ -2393,7 +2393,7 @@ __metadata: resolution: "@metamask/base-controller@workspace:packages/base-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/sinon": ^9.0.10 deepmerge: ^4.2.2 @@ -2431,7 +2431,7 @@ __metadata: resolution: "@metamask/build-utils@workspace:packages/build-utils" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/eslint": ^8.44.7 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 @@ -2465,7 +2465,7 @@ __metadata: "@metamask/snaps-controllers": ^8.1.1 "@metamask/snaps-sdk": ^4.4.1 "@metamask/snaps-utils": ^7.4.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/readable-stream": ^2.3.0 deepmerge: ^4.2.2 @@ -2512,7 +2512,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/eth-query": ^4.0.0 "@metamask/ethjs-unit": ^0.3.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@spruceid/siwe-parser": 2.1.0 "@types/bn.js": ^5.1.5 "@types/jest": ^27.4.1 @@ -2562,7 +2562,7 @@ __metadata: "@metamask/eth-block-tracker": ^9.0.3 "@metamask/eth-json-rpc-provider": ^4.0.0 "@metamask/json-rpc-engine": ^9.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/node": ^16.18.54 "@typescript-eslint/eslint-plugin": ^5.62.0 @@ -2626,7 +2626,7 @@ __metadata: "@metamask/base-controller": ^6.0.0 "@metamask/controller-utils": ^11.0.0 "@metamask/network-controller": ^19.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -2753,7 +2753,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/json-rpc-engine": ^9.0.0 "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -2951,7 +2951,7 @@ __metadata: "@metamask/ethjs-unit": ^0.3.0 "@metamask/network-controller": ^19.0.0 "@metamask/polling-controller": ^8.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/bn.js": ^5.1.5 "@types/jest": ^27.4.1 "@types/jest-when": ^2.7.3 @@ -2980,7 +2980,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/rpc-errors": ^6.2.1 "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -3032,7 +3032,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/json-rpc-engine": ^9.0.0 "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/readable-stream": ^2.3.0 deepmerge: ^4.2.2 @@ -3096,7 +3096,7 @@ __metadata: "@metamask/keyring-api": ^8.0.0 "@metamask/message-manager": ^10.0.0 "@metamask/scure-bip39": ^2.1.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 async-mutex: ^0.5.0 deepmerge: ^4.2.2 @@ -3139,7 +3139,7 @@ __metadata: "@metamask/base-controller": ^6.0.0 "@metamask/controller-utils": ^11.0.0 "@metamask/eth-sig-util": ^7.0.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/uuid": ^8.3.0 deepmerge: ^4.2.2 @@ -3167,7 +3167,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 "@metamask/controller-utils": ^11.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 async-mutex: ^0.5.0 deepmerge: ^4.2.2 @@ -3195,7 +3195,7 @@ __metadata: "@metamask/json-rpc-engine": ^9.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/swappable-obj-proxy": ^2.2.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/jest-when": ^2.7.3 "@types/lodash": ^4.14.191 @@ -3233,7 +3233,7 @@ __metadata: dependencies: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -3317,7 +3317,7 @@ __metadata: "@metamask/controller-utils": ^11.0.0 "@metamask/json-rpc-engine": ^9.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/deep-freeze-strict": ^1.1.0 "@types/jest": ^27.4.1 deep-freeze-strict: ^1.1.1 @@ -3360,7 +3360,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 "@metamask/json-rpc-engine": ^9.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/deep-freeze-strict": ^1.1.0 "@types/jest": ^27.4.1 deep-freeze-strict: ^1.1.1 @@ -3418,7 +3418,7 @@ __metadata: "@metamask/base-controller": ^6.0.0 "@metamask/controller-utils": ^11.0.0 "@metamask/network-controller": ^19.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 "@types/uuid": ^8.3.0 deepmerge: ^4.2.2 @@ -3508,7 +3508,7 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/selected-network-controller": ^15.0.2 "@metamask/swappable-obj-proxy": ^2.2.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 immer: ^9.0.6 @@ -3533,7 +3533,7 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -3581,7 +3581,7 @@ __metadata: "@metamask/network-controller": ^19.0.0 "@metamask/permission-controller": ^10.0.0 "@metamask/swappable-obj-proxy": ^2.2.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 immer: ^9.0.6 @@ -3611,7 +3611,7 @@ __metadata: "@metamask/logging-controller": ^5.0.0 "@metamask/message-manager": ^10.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -3776,7 +3776,7 @@ __metadata: "@metamask/network-controller": ^19.0.0 "@metamask/nonce-tracker": ^5.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/bn.js": ^5.1.5 "@types/jest": ^27.4.1 "@types/node": ^16.18.54 @@ -3820,7 +3820,7 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/superstruct": ^3.1.0 "@metamask/transaction-controller": ^33.0.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@types/jest": ^27.4.1 bn.js: ^5.2.1 deepmerge: ^4.2.2 From a8b8a0d0b47039ae98a358f325b3e639b1d0bf2b Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Tue, 25 Jun 2024 15:45:31 -0400 Subject: [PATCH 20/47] Bump out-of-sync dependencies --- .../package.json | 10 +++---- packages/profile-sync-controller/package.json | 4 +-- yarn.lock | 26 +++---------------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/packages/notification-services-controller/package.json b/packages/notification-services-controller/package.json index cc6bc2975c..abea76d194 100644 --- a/packages/notification-services-controller/package.json +++ b/packages/notification-services-controller/package.json @@ -35,10 +35,10 @@ "changelog:update": "../../scripts/update-changelog.sh @metamask/notification-services-controller", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/notification-services-controller", "publish:preview": "yarn npm publish --tag preview", - "test": "jest --reporters=jest-silent-reporter", - "test:clean": "jest --clearCache", - "test:verbose": "jest --verbose", - "test:watch": "jest --watch" + "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", + "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", + "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", + "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { "@contentful/rich-text-html-renderer": "^16.5.2", @@ -64,7 +64,7 @@ "ts-jest": "^27.1.4", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5" + "typescript": "~5.0.4" }, "peerDependencies": { "@metamask/keyring-controller": "^17.0.0", diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index b423893edc..3e7c04e1ac 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -43,8 +43,8 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/snaps-controllers": "^8.1.1", - "@metamask/snaps-sdk": "^4.2.0", - "@metamask/snaps-utils": "^7.4.0", + "@metamask/snaps-sdk": "^4.4.1", + "@metamask/snaps-utils": "^7.4.1", "@noble/ciphers": "^0.5.2", "@noble/hashes": "^1.4.0", "ethers": "^6.12.0", diff --git a/yarn.lock b/yarn.lock index fb843edbbc..cc24b13ceb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3269,7 +3269,7 @@ __metadata: ts-jest: ^27.1.4 typedoc: ^0.24.8 typedoc-plugin-missing-exports: ^2.0.0 - typescript: ~4.9.5 + typescript: ~5.0.4 uuid: ^8.3.2 peerDependencies: "@metamask/keyring-controller": ^17.0.0 @@ -3474,8 +3474,8 @@ __metadata: "@metamask/auto-changelog": ^3.4.4 "@metamask/base-controller": ^6.0.0 "@metamask/snaps-controllers": ^8.1.1 - "@metamask/snaps-sdk": ^4.2.0 - "@metamask/snaps-utils": ^7.4.0 + "@metamask/snaps-sdk": ^4.4.1 + "@metamask/snaps-utils": ^7.4.1 "@noble/ciphers": ^0.5.2 "@noble/hashes": ^1.4.0 "@types/jest": ^27.4.1 @@ -12737,16 +12737,6 @@ __metadata: languageName: node linkType: hard -"typescript@npm:~4.9.5": - version: 4.9.5 - resolution: "typescript@npm:4.9.5" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: ee000bc26848147ad423b581bd250075662a354d84f0e06eb76d3b892328d8d4440b7487b5a83e851b12b255f55d71835b008a66cbf8f255a11e4400159237db - languageName: node - linkType: hard - "typescript@npm:~5.0.4": version: 5.0.4 resolution: "typescript@npm:5.0.4" @@ -12757,16 +12747,6 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@~4.9.5#~builtin": - version: 4.9.5 - resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin::version=4.9.5&hash=d73830" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20 - languageName: node - linkType: hard - "typescript@patch:typescript@~5.0.4#~builtin": version: 5.0.4 resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=d73830" From b35692d07e605e77a42e33efe977d8db1f142b80 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 26 Jun 2024 13:54:55 -0400 Subject: [PATCH 21/47] Force yarn resolution for `@metamask/provider` to `17.1.0` release candidate --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 5ebfe73288..27276d33e2 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@metamask/abi-utils": "github:MetaMask/abi-utils#release/2.0.3", "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", + "@metamask/provider": "github:MetaMask/provider#release/17.1.0", "@metamask/snaps-registry": "github:MetaMask/snaps-registry#release/3.2.0", "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", "superstruct": "github:MetaMask/superstruct#v3.0.0", From 4cfe39ad97a4717e795b1ad86165416a6c1a12d4 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 14:19:05 -0400 Subject: [PATCH 22/47] Update resolutions for new releases --- package.json | 9 +++++---- yarn.lock | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 27276d33e2..c6b9e528a9 100644 --- a/package.json +++ b/package.json @@ -43,13 +43,14 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/abi-utils": "github:MetaMask/abi-utils#release/2.0.3", + "@metamask/abi-utils": "2.0.3", "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", - "@metamask/provider": "github:MetaMask/provider#release/17.1.0", - "@metamask/snaps-registry": "github:MetaMask/snaps-registry#release/3.2.0", + "@metamask/provider": "17.1.0", + "@metamask/snaps-registry": "3.2.0", "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", - "superstruct": "github:MetaMask/superstruct#v3.0.0", + "@metamask/superstruct": "3.1.0", + "superstruct": "github:MetaMask/superstruct#v3.1.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index cc24b13ceb..ff5fa56233 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2183,13 +2183,13 @@ __metadata: languageName: node linkType: hard -"@metamask/abi-utils@github:MetaMask/abi-utils#release/2.0.3": +"@metamask/abi-utils@npm:2.0.3": version: 2.0.3 - resolution: "@metamask/abi-utils@https://github.com/MetaMask/abi-utils.git#commit=f77d095b0f47c6dfc8956e951215225edc110bb0" + resolution: "@metamask/abi-utils@npm:2.0.3" dependencies: "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.5.0 - checksum: c6f0c9ca55a481751efbe6b1588fbf3df76c48cc78a046fe11b33239abb12fa85c91566894158aa2d9d9eee2f2f3fc516463227b2603254feb17e591a38d4500 + checksum: c0d43cd52a6615b32b09ed6786d01e3de764af30b107941a5df134f8a48da344793035dd247f5b38a56f36c436c7131b94b0c71ef004e88e6e00f878ffa4ebbf languageName: node linkType: hard @@ -3671,15 +3671,15 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@github:MetaMask/snaps-registry#release/3.2.0": +"@metamask/snaps-registry@npm:3.2.0": version: 3.2.0 - resolution: "@metamask/snaps-registry@https://github.com/MetaMask/snaps-registry.git#commit=3edbb5a1e747e8bccca185447691485f471f7a6c" + resolution: "@metamask/snaps-registry@npm:3.2.0" dependencies: "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.5.0 "@noble/curves": ^1.2.0 "@noble/hashes": ^1.3.2 - checksum: 6e2c9778a4bf7f82c0e47b593f2d9930fcd0d1388358b7428acf8bf2d18c25109b2db035e2083a0fd9df9b13eb643b324cb3ec65698a43d3b3b13fd68c5fbf55 + checksum: ac3537cda6454f461e6d00623aefa29ee3e7f7c68003c7629fc550c1f27694115c475d626c89172bd7ecb52de2a0b75db64aa9fe9e8625492e335337d3f579f7 languageName: node linkType: hard @@ -3737,7 +3737,7 @@ __metadata: languageName: node linkType: hard -"@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": +"@metamask/superstruct@npm:3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" checksum: 00e4d0c0aae8b25ccc1885c1db0bb4ed1590010570140c255e4deee3bf8a10c859c8fce5e475b4ae09c8a56316207af87585b91f7f5a5c028d668ccd111f19e3 @@ -12139,10 +12139,10 @@ __metadata: languageName: node linkType: hard -"superstruct@github:MetaMask/superstruct#v3.0.0": - version: 3.0.0 - resolution: "superstruct@https://github.com/MetaMask/superstruct.git#commit=4a2a7b0a77fdb364be6fbdda4c1c8596d24d2dd0" - checksum: b91ffedbddb4794bf7f1616323b22c922dc5c021f2594bbe936255ded359ce0df7d8c80a4f94b97fac37080356f900b80b097932a9d3060b0577101345cedb81 +"superstruct@github:MetaMask/superstruct#v3.1.0": + version: 3.1.0 + resolution: "superstruct@https://github.com/MetaMask/superstruct.git#commit=3cd308f6607bc52e2fa0582f4a778f9ed597e25c" + checksum: 85e7fd4c9046a5cf6fa990d6497f26a7e20493d25143f80269e7c950636679f0604e2ea5f0bcbea78c7351072905ba8998ff2f2ba8e6c4750852fbc58ed82247 languageName: node linkType: hard From cbf9e38182c266287c4f7c1e67380644e7db5b88 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 15:32:22 -0400 Subject: [PATCH 23/47] Remove unused yarn resolution for `superstruct` --- package.json | 1 - yarn.lock | 84 ++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 8b2c56caa4..709d214d07 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "@metamask/snaps-registry": "3.2.0", "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", "@metamask/superstruct": "3.1.0", - "superstruct": "github:MetaMask/superstruct#v3.1.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index e5af1aa5b0..5e392b6aed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3025,7 +3025,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": +"@metamask/json-rpc-middleware-stream@npm:^8.0.0, @metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": version: 0.0.0-use.local resolution: "@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream" dependencies: @@ -3063,17 +3063,18 @@ __metadata: "@metamask/keyring-api@github:MetaMask/keyring-api#replace-superstruct-with-fork": version: 8.0.0 - resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=09f8f6ba9db00d8495066fe2be1dd8b624035a5c" + resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=155384dad1f4d394276c4c639ea495d5840f2b2b" dependencies: - "@metamask/snaps-sdk": "npm:^4.4.2" - "@metamask/superstruct": "npm:^3.0.0" + "@metamask/providers": "npm:^17.1.0" + "@metamask/snaps-sdk": "npm:^6.0.0" + "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^8.5.0" "@types/uuid": "npm:^9.0.8" bech32: "npm:^2.0.0" uuid: "npm:^9.0.1" peerDependencies: "@metamask/providers": ">=15 <18" - checksum: 10/e644e0c7b107942f9c1552a4685380a24b52a541c5186ceafc28c70a1eb298c571b6dd656f8e3b79890f823118b0062e83078c7272a1bcca73b3a4267527006d + checksum: 10/76c38ced7a693e823ba38cc5acd163a7377b3dc39eb98af4aed19e97a26bc00b1118b48d6494eef8168b920f2239925452ff4c3857ff99f58bc960854a0ca5fd languageName: node linkType: hard @@ -3496,6 +3497,27 @@ __metadata: languageName: unknown linkType: soft +"@metamask/providers@npm:^17.1.0": + version: 17.1.0 + resolution: "@metamask/providers@npm:17.1.0" + dependencies: + "@metamask/json-rpc-engine": "npm:^9.0.0" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.0" + "@metamask/object-multiplex": "npm:^2.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/safe-event-emitter": "npm:^3.1.1" + "@metamask/utils": "npm:^8.3.0" + detect-browser: "npm:^5.2.0" + extension-port-stream: "npm:^4.1.0" + fast-deep-equal: "npm:^3.1.3" + is-stream: "npm:^2.0.0" + readable-stream: "npm:^3.6.2" + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/12c24b1c81aff0e60ec69eb878e069a8ea3a61025213e825c074117f2f4dd7779ac1a0be23ab7016d24c5ad1be0bbebf1e4f4f082551bb63d17a0be7e19235e3 + languageName: node + linkType: hard + "@metamask/queued-request-controller@workspace:packages/queued-request-controller": version: 0.0.0-use.local resolution: "@metamask/queued-request-controller@workspace:packages/queued-request-controller" @@ -3554,7 +3576,7 @@ __metadata: languageName: node linkType: hard -"@metamask/safe-event-emitter@npm:^3.0.0": +"@metamask/safe-event-emitter@npm:^3.0.0, @metamask/safe-event-emitter@npm:^3.1.1": version: 3.1.1 resolution: "@metamask/safe-event-emitter@npm:3.1.1" checksum: 10/e24db4d7c20764bfc5b025065f92518c805f0ffb1da4820078b8cff7dcae964c0f354cf053fcb7ac659de015d5ffdf21aae5e8d44e191ee8faa9066855f22653 @@ -3700,9 +3722,9 @@ __metadata: linkType: hard "@metamask/snaps-sdk@github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk": - version: 53.0.0 - resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#branch=replace-superstruct-with-fork%23workspace%3D%40metamask%2Fsnaps-sdk&commit=26bbd2abab70607370d9d32b89af26123bd20c9d" - checksum: 10/1c5b5806fb59c87d212b7e38076328badfa881cc248bf1e52dedae8c9fdfbd9f0fe2a101baab4b832e6333d08fe00ee772fd4382a6ec5cdd48830b3b81dffaa3 + version: 54.0.0 + resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#branch=replace-superstruct-with-fork%23workspace%3D%40metamask%2Fsnaps-sdk&commit=ad0eae47f9c5d02e61abdc170cc7ee7e94e40c72" + checksum: 10/a3e114f3c6a524e100f89bc69a31d1854a80589442fce1ae06b488b3170a485b41e3ba035f52a9382142cdc0bd50b0ae701977506584c9d1fd2f0841b894406f languageName: node linkType: hard @@ -4996,7 +5018,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.11.0": +"acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": version: 8.12.0 resolution: "acorn@npm:8.12.0" bin: @@ -5005,15 +5027,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10/b688e7e3c64d9bfb17b596e1b35e4da9d50553713b3b3630cf5690f2b023a84eac90c56851e6912b483fe60e8b4ea28b254c07e92f17ef83d72d78745a8352dd - languageName: node - linkType: hard - "aes-js@npm:4.0.0-beta.5": version: 4.0.0-beta.5 resolution: "aes-js@npm:4.0.0-beta.5" @@ -6455,6 +6468,13 @@ __metadata: languageName: node linkType: hard +"detect-browser@npm:^5.2.0": + version: 5.3.0 + resolution: "detect-browser@npm:5.3.0" + checksum: 10/4a8551e1f5170633c9aa976f16c57f81f1044d071b2eb853c572bd817bf9cd0cc90c9c520d950edb5accd31b1b0c8ddb7a96e82040b0b5579f9f09c77446a117 + languageName: node + linkType: hard + "detect-file@npm:^1.0.0": version: 1.0.0 resolution: "detect-file@npm:1.0.0" @@ -7522,6 +7542,17 @@ __metadata: languageName: node linkType: hard +"extension-port-stream@npm:^4.1.0": + version: 4.1.0 + resolution: "extension-port-stream@npm:4.1.0" + dependencies: + readable-stream: "npm:^3.6.2 || ^4.4.2" + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/e349277cf65a89c2a6c4f3611f52e0a97497bd2870a4c25aa4ab11b300c48e3013fd95208e3ff6c8494dfb849eed725e7506e59118b1a69e555fa4b67afdbd83 + languageName: node + linkType: hard + "fast-copy@npm:^2.1.7": version: 2.1.7 resolution: "fast-copy@npm:2.1.7" @@ -12149,10 +12180,17 @@ __metadata: languageName: node linkType: hard -"superstruct@github:MetaMask/superstruct#v3.1.0": - version: 3.1.0 - resolution: "superstruct@https://github.com/MetaMask/superstruct.git#commit=3cd308f6607bc52e2fa0582f4a778f9ed597e25c" - checksum: 10/4e83bc2ceb3fd0d3ba1a6b61a515a6364583c0913231f874ed70ffbab9733735a25b29332cca439e766203b18909f57441119fbc9e2434ecf8a61a5b9c157006 +"superstruct@npm:1.0.3": + version: 1.0.3 + resolution: "superstruct@npm:1.0.3" + checksum: 10/632b6171ac136b6750e62a55f806cc949b3dbf2b4a7dc70cc85f54adcdf19d21eab9711f04e8a643b7dd622bbd8658366ead924f467adaccb2c8005c133b7976 + languageName: node + linkType: hard + +"superstruct@npm:^1.0.3": + version: 1.0.4 + resolution: "superstruct@npm:1.0.4" + checksum: 10/9b3fd70a08c5ad3ea78b5c6b7ab90d31dde71af10448208d296c3d29ba2e55dfd817dfef75957163ee032163d04c4b2e0cb2fddff30313516aa60f748c1a48da languageName: node linkType: hard From 55a507e6ee3bd5dcd3f25de7c3cf2f899c0e5751 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 15:34:59 -0400 Subject: [PATCH 24/47] Remove yarn resolutions for `@metamask/{providers,snaps-registry}` --- package.json | 2 -- yarn.lock | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 709d214d07..7a6df8d6c5 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,6 @@ "@metamask/abi-utils": "2.0.3", "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", - "@metamask/provider": "17.1.0", - "@metamask/snaps-registry": "3.2.0", "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", "@metamask/superstruct": "3.1.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" diff --git a/yarn.lock b/yarn.lock index 5e392b6aed..093f909b90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3693,7 +3693,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:3.2.0": +"@metamask/snaps-registry@npm:^3.1.0": version: 3.2.0 resolution: "@metamask/snaps-registry@npm:3.2.0" dependencies: From 90962b5628ccfd659f20bf4a81653478c77af313 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 15:35:43 -0400 Subject: [PATCH 25/47] [assets-controllers] Bump `@metamask/abi-utils` from `^2.0.2` to `^2.0.3` --- package.json | 1 - packages/assets-controllers/package.json | 2 +- yarn.lock | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7a6df8d6c5..f1ca463070 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/abi-utils": "2.0.3", "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index f4a6a7dded..99e24b14d0 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -46,7 +46,7 @@ "@ethersproject/bignumber": "^5.7.0", "@ethersproject/contracts": "^5.7.0", "@ethersproject/providers": "^5.7.0", - "@metamask/abi-utils": "^2.0.2", + "@metamask/abi-utils": "^2.0.3", "@metamask/accounts-controller": "^17.1.1", "@metamask/approval-controller": "^7.0.0", "@metamask/base-controller": "^6.0.0", diff --git a/yarn.lock b/yarn.lock index 093f909b90..5457315deb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2183,7 +2183,7 @@ __metadata: languageName: node linkType: hard -"@metamask/abi-utils@npm:2.0.3": +"@metamask/abi-utils@npm:^2.0.2, @metamask/abi-utils@npm:^2.0.3": version: 2.0.3 resolution: "@metamask/abi-utils@npm:2.0.3" dependencies: @@ -2310,7 +2310,7 @@ __metadata: "@ethersproject/bignumber": "npm:^5.7.0" "@ethersproject/contracts": "npm:^5.7.0" "@ethersproject/providers": "npm:^5.7.0" - "@metamask/abi-utils": "npm:^2.0.2" + "@metamask/abi-utils": "npm:^2.0.3" "@metamask/accounts-controller": "npm:^17.1.1" "@metamask/approval-controller": "npm:^7.0.0" "@metamask/auto-changelog": "npm:^3.4.4" From 7760b3d3d20e891b35de11885faba2d342e8748e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 16:02:24 -0400 Subject: [PATCH 26/47] Add yarn patches for `@metamask/snaps-{sdk,utils}` removing `superstruct` imports --- ...amask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch | 922 ++++++++++++++++++ ...ask-snaps-utils-npm-7.7.0-2cc1f044af.patch | 702 +++++++++++++ package.json | 7 +- packages/accounts-controller/package.json | 4 +- packages/chain-controller/package.json | 4 +- packages/profile-sync-controller/package.json | 4 +- yarn.lock | 74 +- 7 files changed, 1698 insertions(+), 19 deletions(-) create mode 100644 .yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch create mode 100644 .yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch diff --git a/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch b/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch new file mode 100644 index 0000000000..d1d1af1523 --- /dev/null +++ b/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch @@ -0,0 +1,922 @@ +diff --git a/dist/index.js.map b/dist/index.js.map +index bc3f309176a232b6b86e5f564ae0b39e155f7682..e70dfadc820a716f322123c11580549fbe515b5f 100644 +--- a/dist/index.js.map ++++ b/dist/index.js.map +@@ -1 +1,125 @@ +-{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { boolean, nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;A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;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;AD7aM,IAAM,kBAAc,4BAAM,CAAC,gBAAY,6BAAO,OAAG,8BAAQ,CAAC,CAAC;AAE3D,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,+BAAS,WAAW,CAAC;AAE9D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,+BAAS,WAAW,CAAC,CAAC;AAChD;AAOO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;","names":["error","superstructLiteral","superstructUnion","import_superstruct","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_utils","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} +\ No newline at end of file ++{ ++ "version": 3, ++ "sources": [ ++ "../src/index.ts", ++ "../src/errors.ts", ++ "../src/internals/error-wrappers.ts", ++ "../src/internals/errors.ts", ++ "../src/internals/structs.ts", ++ "../src/internals/jsx.ts", ++ "../src/internals/svg.ts", ++ "../src/error-wrappers.ts", ++ "../src/images.ts", ++ "../src/ui/components/address.ts", ++ "../src/ui/builder.ts", ++ "../src/ui/nodes.ts", ++ "../src/ui/components/copyable.ts", ++ "../src/ui/components/divider.ts", ++ "../src/ui/components/heading.ts", ++ "../src/ui/components/image.ts", ++ "../src/ui/components/panel.ts", ++ "../src/ui/components/button.ts", ++ "../src/ui/components/form.ts", ++ "../src/ui/components/input.ts", ++ "../src/ui/components/row.ts", ++ "../src/ui/components/text.ts", ++ "../src/ui/components/spinner.ts", ++ "../src/ui/component.ts", ++ "../src/types/handlers/transaction.ts", ++ "../src/types/handlers/user-input.ts", ++ "../src/types/methods/dialog.ts", ++ "../src/types/methods/get-file.ts", ++ "../src/types/methods/manage-state.ts", ++ "../src/types/methods/notify.ts", ++ "../src/types/interface.ts", ++ "../src/jsx/validation.ts" ++ ], ++ "sourcesContent": [ ++ "// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n", ++ "import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n", ++ "import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n", ++ "import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n", ++ "import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n", ++ "import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n", ++ "import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n", ++ "import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from '@metamask/superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string, unknown } from '@metamask/superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n", ++ "import type { Infer, Struct } from '@metamask/superstruct';\nimport { array, assign, lazy, literal, object, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { array, assign, literal, object, string, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string, optional, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n", ++ "import { assertStruct } from '@metamask/utils';\nimport { is } from '@metamask/superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n", ++ "import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from '@metamask/superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n", ++ "import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n", ++ "import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n", ++ "import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n", ++ "import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n", ++ "import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { boolean, nullable, record, string, union } from '@metamask/superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n", ++ "import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n" ++ ], ++ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,Y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SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCP;AAAA,EACA;AAAA,EACA;AAAA,EACAH;AAAA,EACAI;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAH;AAAA,EACAI;AAAA,EACAL;AAAA,EACAM;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;AD7aM,IAAM,kBAAc,4BAAM,CAAC,gBAAY,6BAAO,OAAG,8BAAQ,CAAC,CAAC;AAE3D,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,+BAAS,WAAW,CAAC;AAE9D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,+BAAS,WAAW,CAAC,CAAC;AAChD;AAOO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;", ++ "names": [ ++ "error", ++ "superstructLiteral", ++ "superstructUnion", ++ "import_superstruct", ++ "import_utils", ++ "import_utils", ++ "import_utils", ++ "import_superstruct", ++ "import_utils", ++ "node", ++ "import_superstruct", ++ "NodeType", ++ "import_superstruct", ++ "import_superstruct", ++ "import_superstruct", ++ "import_superstruct", ++ "import_superstruct", ++ "import_superstruct", ++ "ButtonVariant", ++ "ButtonType", ++ "import_superstruct", ++ "import_superstruct", ++ "InputType", ++ "import_superstruct", ++ "import_superstruct", ++ "RowVariant", ++ "import_superstruct", ++ "import_utils", ++ "import_superstruct", ++ "SeverityLevel", ++ "import_superstruct", ++ "UserInputEventType", ++ "DialogType", ++ "AuxiliaryFileEncoding", ++ "ManageStateOperation", ++ "NotificationType", ++ "import_utils", ++ "import_superstruct", ++ "import_utils", ++ "import_superstruct", ++ "ButtonStruct", ++ "InputStruct", ++ "FormStruct", ++ "AddressStruct", ++ "CopyableStruct", ++ "DividerStruct", ++ "HeadingStruct", ++ "ImageStruct", ++ "TextStruct", ++ "RowStruct", ++ "SpinnerStruct" ++ ] ++} +\ No newline at end of file +diff --git a/dist/index.mjs.map b/dist/index.mjs.map +index d9c617eb5a025482055070d7d000215f44926838..ada98186b6ddd69bce003f4f834ea49ed65d09c5 100644 +--- a/dist/index.mjs.map ++++ b/dist/index.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { boolean, nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AA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E3D,IAAM,kBAAkBC,QAAOF,SAAO,GAAGG,UAAS,WAAW,CAAC;AAE9D,IAAM,uBAAuBD;AAAA,EAClCF,SAAO;AAAA,EACPD,OAAM,CAAC,iBAAiBI,UAAS,WAAW,CAAC,CAAC;AAChD;AAOO,IAAM,2BAA2BJ,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBG,QAAOF,SAAO,GAAGI,WAAU;","names":["error","assert","assign","literal","object","node","string","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","SeverityLevel","assign","literal","object","optional","string","union","boolean","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","boolean","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","number","object","record","string","string","number","object","record","nullable","array","lazy","boolean","ButtonStruct","optional","InputStruct","FormStruct","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","union","string","boolean","record","nullable","JsonStruct"]} +\ No newline at end of file ++{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from '@metamask/superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string, unknown } from '@metamask/superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport { array, assign, lazy, literal, object, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { array, assign, literal, object, string, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string, optional, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from '@metamask/superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from '@metamask/superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { boolean, nullable, record, string, union } from '@metamask/superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MA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QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCR;AAAA,EACA;AAAA,EACA;AAAA,EACAJ;AAAA,EACAM;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAJ;AAAA,EACAK;AAAA,EACAN;AAAA,EACAO;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DV;AAAA,EACAE;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;AD7aM,IAAM,cAAcG,OAAM,CAAC,YAAYC,SAAO,GAAGC,SAAQ,CAAC,CAAC;AAE3D,IAAM,kBAAkBC,QAAOF,SAAO,GAAGG,UAAS,WAAW,CAAC;AAE9D,IAAM,uBAAuBD;AAAA,EAClCF,SAAO;AAAA,EACPD,OAAM,CAAC,iBAAiBI,UAAS,WAAW,CAAC,CAAC;AAChD;AAOO,IAAM,2BAA2BJ,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBG,QAAOF,SAAO,GAAGI,WAAU;","names":["error","assert","assign","literal","object","node","string","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","SeverityLevel","assign","literal","object","optional","string","union","boolean","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","boolean","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","number","object","record","string","string","number","object","record","nullable","array","lazy","boolean","ButtonStruct","optional","InputStruct","FormStruct","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","union","string","boolean","record","nullable","JsonStruct"]} +\ No newline at end of file +diff --git a/dist/jsx/index.js.map b/dist/jsx/index.js.map +index 9fda623ee0a5d0737fc1aa95e1479c8d83068206..be2ef2f3fe8a8e82844815880acb22a37f21867f 100644 +--- a/dist/jsx/index.js.map ++++ b/dist/jsx/index.js.map +@@ -1 +1,96 @@ +-{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Checkbox.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/FileInput.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/components/Tooltip.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n","import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoFA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;ACrFA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAeN,IAAM,WAAW,oBAAgDA,KAAI;;;ACf5E,IAAMC,QAAO;AAkBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACpB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACTxE,IAAMC,QAAO;AAqBN,IAAM,QAAQ,oBAA6CA,KAAI;;;AC3BtE,IAAMC,QAAO;AA0BN,IAAM,YAAY,oBAAiDA,KAAI;;;AC5B9E,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AChBpE,IAAMC,QAAO;AAeN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KAAI;;;ACfpE,IAAMC,SAAO;AAeN,IAAM,SAAS,oBAA8CA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TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","import_superstruct","element"]} +\ No newline at end of file ++{ ++ "version": 3, ++ "sources": [ ++ "../../src/jsx/index.ts", ++ "../../src/jsx/component.ts", ++ "../../src/jsx/components/form/Button.ts", ++ "../../src/jsx/components/form/Checkbox.ts", ++ "../../src/jsx/components/form/Dropdown.ts", ++ "../../src/jsx/components/form/Option.ts", ++ "../../src/jsx/components/form/Field.ts", ++ "../../src/jsx/components/form/FileInput.ts", ++ "../../src/jsx/components/form/Form.ts", ++ "../../src/jsx/components/form/Input.ts", ++ "../../src/jsx/components/formatting/Bold.ts", ++ "../../src/jsx/components/formatting/Italic.ts", ++ "../../src/jsx/components/Address.ts", ++ "../../src/jsx/components/Box.ts", ++ "../../src/jsx/components/Copyable.ts", ++ "../../src/jsx/components/Divider.ts", ++ "../../src/jsx/components/Value.ts", ++ "../../src/jsx/components/Heading.ts", ++ "../../src/jsx/components/Image.ts", ++ "../../src/jsx/components/Link.ts", ++ "../../src/jsx/components/Row.ts", ++ "../../src/jsx/components/Spinner.ts", ++ "../../src/jsx/components/Text.ts", ++ "../../src/jsx/components/Tooltip.ts", ++ "../../src/jsx/jsx-runtime.ts", ++ "../../src/jsx/validation.ts", ++ "../../src/internals/structs.ts", ++ "../../src/internals/jsx.ts", ++ "../../src/internals/svg.ts", ++ "../../src/jsx/jsx-dev-runtime.ts" ++ ], ++ "sourcesContent": [ ++ "export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n", ++ "import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n", ++ "import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n", ++ "import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n", ++ "import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n", ++ "import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n", ++ "import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n", ++ "import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n", ++ "import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n", ++ "import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n", ++ "import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n", ++ "import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n", ++ "import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n", ++ "import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n", ++ "import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n", ++ "import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n", ++ "import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n", ++ "import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n", ++ "import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n", ++ "import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n", ++ "import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n" ++ ], ++ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,aACE,4BAAc,KAAK,SACnB,0BAAY,OAAO,MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;", ++ "names": [ ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "TYPE", ++ "import_superstruct", ++ "superstructLiteral", ++ "superstructUnion", ++ "import_superstruct", ++ "element" ++ ] ++} +\ No newline at end of file +diff --git a/dist/jsx/index.mjs.map b/dist/jsx/index.mjs.map +index f20039d01fa7d6a3299c584bdbb5dea4a7015b1c..59b66e001ec9c9d35d61842f2b6108e7671cf3b4 100644 +--- a/dist/jsx/index.mjs.map ++++ b/dist/jsx/index.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Checkbox.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/FileInput.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/components/Tooltip.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n","import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAoFA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;ACrFA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAeN,IAAM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AAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","string","string","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Checkbox.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/FileInput.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/components/Tooltip.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n","import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSX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AS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","string","string","element"]} +\ No newline at end of file +diff --git a/dist/jsx/jsx-dev-runtime.js.map b/dist/jsx/jsx-dev-runtime.js.map +index 1e5fc396137dbe46ac2b6d8d1b43d754e9144d5e..c3d6e09bfa464571f12c6497d55c4c8b009525cf 100644 +--- a/dist/jsx/jsx-dev-runtime.js.map ++++ b/dist/jsx/jsx-dev-runtime.js.map +@@ -1 +1,27 @@ +-{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n", ++ "import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n", ++ "import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n", ++ "import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n", ++ "import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n", ++ "import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO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Aa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["string","string","element"]} +\ No newline at end of file ++{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAA;AAAA,EACA;AAAA,OACK;;;AClBP;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AA0BA,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,SAAS,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAA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EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["string","string","element"]} +\ No newline at end of file +diff --git a/dist/types/internals/jsx.d.ts b/dist/types/internals/jsx.d.ts +index 29e858a8689399c6b322fca954fb45416b4e49c9..5c948dd3f7d5e76947f4ef8d40038f197e8e69a2 100644 +--- a/dist/types/internals/jsx.d.ts ++++ b/dist/types/internals/jsx.d.ts +@@ -1,5 +1,5 @@ +-import type { Infer, Struct } from 'superstruct'; +-import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct/dist/utils'; ++import type { Infer, Struct } from '@metamask/superstruct'; ++import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from '@metamask/superstruct'; + import type { EmptyObject } from '../types'; + /** + * Check if a type is a union. Infers `true` if it is a union, otherwise +diff --git a/dist/types/internals/structs.d.ts b/dist/types/internals/structs.d.ts +index bbfc1289001614aa48dca8aef392f619be8281bb..f4f2d1187c88f28d68b9ddae42bd535bfd1cbfed 100644 +--- a/dist/types/internals/structs.d.ts ++++ b/dist/types/internals/structs.d.ts +@@ -1,6 +1,6 @@ +-import type { Infer } from 'superstruct'; +-import { Struct } from 'superstruct'; +-import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; ++import type { Infer } from '@metamask/superstruct'; ++import { Struct } from '@metamask/superstruct'; ++import type { AnyStruct, InferStructTuple } from '@metamask/superstruct'; + import type { EnumToUnion } from './helpers'; + /** + * A wrapper of `superstruct`'s `literal` struct that also defines the name of +diff --git a/dist/types/internals/svg.d.ts b/dist/types/internals/svg.d.ts +index cda3bd7e7b1cde37099c830ce451ac6d5c190b4a..cd4a5d29aa53d1eac86eac29533d468d160e5d8c 100644 +--- a/dist/types/internals/svg.d.ts ++++ b/dist/types/internals/svg.d.ts +@@ -4,4 +4,4 @@ + * @returns A Struct that validates a string as a valid SVG. + * @internal + */ +-export declare function svg(): import("superstruct").Struct; ++export declare function svg(): import("@metamask/superstruct").Struct; +diff --git a/dist/types/jsx/validation.d.ts b/dist/types/jsx/validation.d.ts +index 21db53ee2779ef671a7b850f3d5bfb44fd9ff658..8574d03c250f8d4b932af45266f8f48a529b2b5a 100644 +--- a/dist/types/jsx/validation.d.ts ++++ b/dist/types/jsx/validation.d.ts +@@ -1,4 +1,4 @@ +-import type { Struct } from 'superstruct'; ++import type { Struct } from '@metamask/superstruct'; + import type { Describe } from '../internals'; + import type { GenericSnapElement, Key, SnapElement, StringElement } from './component'; + import type { AddressElement, BoldElement, BoxElement, ButtonElement, CheckboxElement, CopyableElement, DividerElement, DropdownElement, OptionElement, FieldElement, FormElement, HeadingElement, ImageElement, InputElement, ItalicElement, JSXElement, LinkElement, RowElement, SpinnerElement, StandardFormattingElement, TextElement, TooltipElement, ValueElement, FileInputElement } from './components'; +diff --git a/dist/types/types/handlers/user-input.d.ts b/dist/types/types/handlers/user-input.d.ts +index d62972089a6492d765da7389902eb00c2aff6069..44afb0ee2c2a7ea0e4c8ab1460409b7df1adbcab 100644 +--- a/dist/types/types/handlers/user-input.d.ts ++++ b/dist/types/types/handlers/user-input.d.ts +@@ -1,4 +1,4 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import type { InterfaceContext } from '../interface'; + /** + * The type of user input event fired. +@@ -15,19 +15,19 @@ export declare enum UserInputEventType { + InputChangeEvent = "InputChangeEvent", + FileUploadEvent = "FileUploadEvent" + } +-export declare const GenericEventStruct: import("superstruct").Struct<{ ++export declare const GenericEventStruct: import("@metamask/superstruct").Struct<{ + type: string; + name?: string | undefined; + }, { +- type: import("superstruct").Struct; +- name: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; + }>; +-export declare const ButtonClickEventStruct: import("superstruct").Struct<{ ++export declare const ButtonClickEventStruct: import("@metamask/superstruct").Struct<{ + type: UserInputEventType.ButtonClickEvent; + name?: string | undefined; + }, { +- type: import("superstruct").Struct; +- name: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; + }>; + /** + * A button click event fired in the UI. This is passed to the params of the +@@ -38,16 +38,16 @@ export declare const ButtonClickEventStruct: import("superstruct").Struct<{ + * @property name - The optional component name that fired the event. + */ + export declare type ButtonClickEvent = Infer; +-export declare const FileStruct: import("superstruct").Struct<{ ++export declare const FileStruct: import("@metamask/superstruct").Struct<{ + name: string; + size: number; + contentType: string; + contents: string; + }, { +- name: import("superstruct").Struct; +- size: import("superstruct").Struct; +- contentType: import("superstruct").Struct; +- contents: import("superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; ++ size: import("@metamask/superstruct").Struct; ++ contentType: import("@metamask/superstruct").Struct; ++ contents: import("@metamask/superstruct").Struct; + }>; + /** + * A file object containing the file name, size, content type, and the base64 +@@ -59,7 +59,7 @@ export declare const FileStruct: import("superstruct").Struct<{ + * @property contents - The base64 encoded contents of the file. + */ + export declare type File = Infer; +-export declare const FormSubmitEventStruct: import("superstruct").Struct<{ ++export declare const FormSubmitEventStruct: import("@metamask/superstruct").Struct<{ + value: Record; +- value: import("superstruct").Struct; ++ value: import("@metamask/superstruct").Struct, null>; +- name: import("superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; + }>; + /** + * A form submit event, which is fired when a submit button is clicked. +@@ -92,14 +92,14 @@ export declare const FormSubmitEventStruct: import("superstruct").Struct<{ + * {@link File}. + */ + export declare type FormSubmitEvent = Infer; +-export declare const InputChangeEventStruct: import("superstruct").Struct<{ ++export declare const InputChangeEventStruct: import("@metamask/superstruct").Struct<{ + value: string | boolean; + type: UserInputEventType.InputChangeEvent; + name: string; + }, { +- type: import("superstruct").Struct; +- name: import("superstruct").Struct; +- value: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; + }>; + /** + * An input change event, which is fired when the value of an input field +@@ -110,7 +110,7 @@ export declare const InputChangeEventStruct: import("superstruct").Struct<{ + * @property value - The new value of the input field. + */ + export declare type InputChangeEvent = Infer; +-export declare const FileUploadEventStruct: import("superstruct").Struct<{ ++export declare const FileUploadEventStruct: import("@metamask/superstruct").Struct<{ + type: UserInputEventType.FileUploadEvent; + name: string; + file: { +@@ -120,18 +120,18 @@ export declare const FileUploadEventStruct: import("superstruct").Struct<{ + contents: string; + } | null; + }, { +- type: import("superstruct").Struct; +- name: import("superstruct").Struct; +- file: import("superstruct").Struct<{ ++ type: import("@metamask/superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; ++ file: import("@metamask/superstruct").Struct<{ + name: string; + size: number; + contentType: string; + contents: string; + } | null, { +- name: import("superstruct").Struct; +- size: import("superstruct").Struct; +- contentType: import("superstruct").Struct; +- contents: import("superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; ++ size: import("@metamask/superstruct").Struct; ++ contentType: import("@metamask/superstruct").Struct; ++ contents: import("@metamask/superstruct").Struct; + }>; + }>; + /** +@@ -145,7 +145,7 @@ export declare const FileUploadEventStruct: import("superstruct").Struct<{ + * @see File + */ + export declare type FileUploadEvent = Infer; +-export declare const UserInputEventStruct: import("superstruct").Struct<{ ++export declare const UserInputEventStruct: import("@metamask/superstruct").Struct<{ + type: UserInputEventType.ButtonClickEvent; + name?: string | undefined; + } | { +diff --git a/dist/types/types/interface.d.ts b/dist/types/types/interface.d.ts +index a927a12f5a07f0f7a1a239499ae7a88015b7ffa8..7d7bd5b46ccf0435b3e9e032f8380d7dfffcf3a4 100644 +--- a/dist/types/types/interface.d.ts ++++ b/dist/types/types/interface.d.ts +@@ -1,4 +1,4 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import type { JSXElement } from '../jsx'; + import type { Component } from '../ui'; + /** +@@ -7,19 +7,19 @@ import type { Component } from '../ui'; + * root state) and the root state since a key in the root stat can contain + * either the value of an input or a sub-state of a form. + */ +-export declare const StateStruct: import("superstruct").Struct; +-export declare const FormStateStruct: import("superstruct").Struct, null>; +-export declare const InterfaceStateStruct: import("superstruct").Struct; + export declare type FormState = Infer; + export declare type InterfaceState = Infer; + export declare type ComponentOrElement = Component | JSXElement; +-export declare const ComponentOrElementStruct: import("superstruct").Struct<{ ++export declare const ComponentOrElementStruct: import("@metamask/superstruct").Struct<{ + value: string; + type: import("../ui").NodeType.Copyable; + sensitive?: boolean | undefined; +@@ -108,5 +108,5 @@ export declare const ComponentOrElementStruct: import("superstruct").Struct<{ + src: string; + alt?: string | undefined; + }, "Image"> | import("../jsx").SnapElement | import("../jsx").SnapElement | import("../jsx").SnapElement | import("../jsx").SnapElement, "Spinner"> | import("../jsx").SnapElement, null>; +-export declare const InterfaceContextStruct: import("superstruct").Struct, null>; ++export declare const InterfaceContextStruct: import("@metamask/superstruct").Struct, null>; + export declare type InterfaceContext = Infer; +diff --git a/dist/types/ui/builder.d.ts b/dist/types/ui/builder.d.ts +index cdbb9fec64a64302ee6d8b0441faa872c6d4b48f..b03d1adb44a055a2af2e1442aa5395f614a89219 100644 +--- a/dist/types/ui/builder.d.ts ++++ b/dist/types/ui/builder.d.ts +@@ -1,4 +1,4 @@ +-import type { Struct } from 'superstruct'; ++import type { Struct } from '@metamask/superstruct'; + import type { Component } from './components'; + import type { NodeType } from './nodes'; + /** +diff --git a/dist/types/ui/components/address.d.ts b/dist/types/ui/components/address.d.ts +index fc348d22cba13fba7ada95b86df12371268b0c82..e813400f74734a036aefb4c638dd87dcafac97dd 100644 +--- a/dist/types/ui/components/address.d.ts ++++ b/dist/types/ui/components/address.d.ts +@@ -1,11 +1,11 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const AddressStruct: import("superstruct").Struct<{ ++export declare const AddressStruct: import("@metamask/superstruct").Struct<{ + value: `0x${string}`; + type: NodeType.Address; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct<`0x${string}`, null>; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct<`0x${string}`, null>; + }>; + /** + * A address node, that renders an EVM-like address and its icon. +diff --git a/dist/types/ui/components/button.d.ts b/dist/types/ui/components/button.d.ts +index 93e515c52bc31e95c8737a1ebe3efd2b89037aed..f986028d23272e3f5ac56c406c14b5e1ee0c4034 100644 +--- a/dist/types/ui/components/button.d.ts ++++ b/dist/types/ui/components/button.d.ts +@@ -1,4 +1,4 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; + export declare enum ButtonVariant { + Primary = "primary", +@@ -8,18 +8,18 @@ export declare enum ButtonType { + Button = "button", + Submit = "submit" + } +-export declare const ButtonStruct: import("superstruct").Struct<{ ++export declare const ButtonStruct: import("@metamask/superstruct").Struct<{ + value: string; + type: NodeType.Button; + name?: string | undefined; + variant?: "primary" | "secondary" | undefined; + buttonType?: "button" | "submit" | undefined; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct; +- variant: import("superstruct").Struct<"primary" | "secondary" | undefined, null>; +- buttonType: import("superstruct").Struct<"button" | "submit" | undefined, null>; +- name: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; ++ variant: import("@metamask/superstruct").Struct<"primary" | "secondary" | undefined, null>; ++ buttonType: import("@metamask/superstruct").Struct<"button" | "submit" | undefined, null>; ++ name: import("@metamask/superstruct").Struct; + }>; + /** + * A button node, that renders either a primary or a secondary button. +diff --git a/dist/types/ui/components/copyable.d.ts b/dist/types/ui/components/copyable.d.ts +index f89ae230dc0631692934113df5659fe6dd428f69..2949ed74cc6881e034332e67427c742b918b3b12 100644 +--- a/dist/types/ui/components/copyable.d.ts ++++ b/dist/types/ui/components/copyable.d.ts +@@ -1,13 +1,13 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const CopyableStruct: import("superstruct").Struct<{ ++export declare const CopyableStruct: import("@metamask/superstruct").Struct<{ + value: string; + type: NodeType.Copyable; + sensitive?: boolean | undefined; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct; +- sensitive: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; ++ sensitive: import("@metamask/superstruct").Struct; + }>; + /** + * Text that can be copied to the clipboard. It can optionally be marked as +diff --git a/dist/types/ui/components/divider.d.ts b/dist/types/ui/components/divider.d.ts +index c083b5254173b6bf1f251a7a6dfef439fedde091..768552d67230c39db125bb6e8c0a351a521f2652 100644 +--- a/dist/types/ui/components/divider.d.ts ++++ b/dist/types/ui/components/divider.d.ts +@@ -1,9 +1,9 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const DividerStruct: import("superstruct").Struct<{ ++export declare const DividerStruct: import("@metamask/superstruct").Struct<{ + type: NodeType.Divider; + }, { +- type: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; + }>; + /** + * A divider node, that renders a line between other nodes. +diff --git a/dist/types/ui/components/form.d.ts b/dist/types/ui/components/form.d.ts +index 0e2490c9a6686cd5687d5d51a2a0480622a9e3e7..e968d4743baf19e92f2f2c572577ed08f2b59e2f 100644 +--- a/dist/types/ui/components/form.d.ts ++++ b/dist/types/ui/components/form.d.ts +@@ -1,6 +1,6 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const FormComponentStruct: import("superstruct").Struct<{ ++export declare const FormComponentStruct: import("@metamask/superstruct").Struct<{ + type: NodeType.Input; + name: string; + value?: string | undefined; +@@ -19,7 +19,7 @@ export declare const FormComponentStruct: import("superstruct").Struct<{ + * The subset of nodes allowed as children in the {@link Form} node. + */ + export declare type FormComponent = Infer; +-export declare const FormStruct: import("superstruct").Struct<{ ++export declare const FormStruct: import("@metamask/superstruct").Struct<{ + type: NodeType.Form; + name: string; + children: ({ +@@ -38,8 +38,8 @@ export declare const FormStruct: import("superstruct").Struct<{ + buttonType?: "button" | "submit" | undefined; + })[]; + }, { +- type: import("superstruct").Struct; +- children: import("superstruct").Struct<({ ++ type: import("@metamask/superstruct").Struct; ++ children: import("@metamask/superstruct").Struct<({ + type: NodeType.Input; + name: string; + value?: string | undefined; +@@ -53,7 +53,7 @@ export declare const FormStruct: import("superstruct").Struct<{ + name?: string | undefined; + variant?: "primary" | "secondary" | undefined; + buttonType?: "button" | "submit" | undefined; +- })[], import("superstruct").Struct<{ ++ })[], import("@metamask/superstruct").Struct<{ + type: NodeType.Input; + name: string; + value?: string | undefined; +@@ -68,7 +68,7 @@ export declare const FormStruct: import("superstruct").Struct<{ + variant?: "primary" | "secondary" | undefined; + buttonType?: "button" | "submit" | undefined; + }, null>>; +- name: import("superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; + }>; + /** + * A form node that takes children {@link FormComponent} nodes and renders a form. +diff --git a/dist/types/ui/components/heading.d.ts b/dist/types/ui/components/heading.d.ts +index 0c88af706c0e9fa06356a0ff0e3ce39e3396fc01..5822d5120181f3d44b5b8455895e0bb7e3620fdf 100644 +--- a/dist/types/ui/components/heading.d.ts ++++ b/dist/types/ui/components/heading.d.ts +@@ -1,11 +1,11 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const HeadingStruct: import("superstruct").Struct<{ ++export declare const HeadingStruct: import("@metamask/superstruct").Struct<{ + value: string; + type: NodeType.Heading; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; + }>; + /** + * A heading node, that renders the text as a heading. The level of the heading +diff --git a/dist/types/ui/components/image.d.ts b/dist/types/ui/components/image.d.ts +index 1a98bf991bb019cf4a0bbf28d336f1ba03904a63..191073b8984b739d601a1224521280dcb3e54511 100644 +--- a/dist/types/ui/components/image.d.ts ++++ b/dist/types/ui/components/image.d.ts +@@ -1,11 +1,11 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const ImageStruct: import("superstruct").Struct<{ ++export declare const ImageStruct: import("@metamask/superstruct").Struct<{ + value: string; + type: NodeType.Image; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; + }>; + /** + * An image node, that renders an SVG image. +diff --git a/dist/types/ui/components/input.d.ts b/dist/types/ui/components/input.d.ts +index 51dd69f485dbab7c47aa594288ffae11df7a5334..a488eeaea8eba90ce79de8fbb96fd95f089b7739 100644 +--- a/dist/types/ui/components/input.d.ts ++++ b/dist/types/ui/components/input.d.ts +@@ -1,4 +1,4 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; + /** + * This replicates the available input types from the metamask extension. +@@ -9,7 +9,7 @@ export declare enum InputType { + Number = "number", + Password = "password" + } +-export declare const InputStruct: import("superstruct").Struct<{ ++export declare const InputStruct: import("@metamask/superstruct").Struct<{ + type: NodeType.Input; + name: string; + value?: string | undefined; +@@ -18,13 +18,13 @@ export declare const InputStruct: import("superstruct").Struct<{ + inputType?: "number" | "text" | "password" | undefined; + placeholder?: string | undefined; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct; +- name: import("superstruct").Struct; +- inputType: import("superstruct").Struct<"number" | "text" | "password" | undefined, null>; +- placeholder: import("superstruct").Struct; +- label: import("superstruct").Struct; +- error: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; ++ name: import("@metamask/superstruct").Struct; ++ inputType: import("@metamask/superstruct").Struct<"number" | "text" | "password" | undefined, null>; ++ placeholder: import("@metamask/superstruct").Struct; ++ label: import("@metamask/superstruct").Struct; ++ error: import("@metamask/superstruct").Struct; + }>; + /** + * An input node, that renders an input. +diff --git a/dist/types/ui/components/panel.d.ts b/dist/types/ui/components/panel.d.ts +index da4a2742eb6b6e47a06588636d48ed39b6bbcec3..d57f2a6c6e21daefe20f66041cb3fb3b5717acda 100644 +--- a/dist/types/ui/components/panel.d.ts ++++ b/dist/types/ui/components/panel.d.ts +@@ -1,4 +1,4 @@ +-import type { Infer, Struct } from 'superstruct'; ++import type { Infer, Struct } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; + /** + * @internal +diff --git a/dist/types/ui/components/row.d.ts b/dist/types/ui/components/row.d.ts +index 048e044f3cca6be0a9a0e8577dd26e139dc00dcb..3a9cf456be9f78bbb1843c1097d715e2a5febc8b 100644 +--- a/dist/types/ui/components/row.d.ts ++++ b/dist/types/ui/components/row.d.ts +@@ -1,11 +1,11 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; + export declare enum RowVariant { + Default = "default", + Critical = "critical", + Warning = "warning" + } +-export declare const RowStruct: import("superstruct").Struct<{ ++export declare const RowStruct: import("@metamask/superstruct").Struct<{ + value: { + value: string; + type: NodeType.Image; +@@ -21,10 +21,10 @@ export declare const RowStruct: import("superstruct").Struct<{ + label: string; + variant?: "default" | "warning" | "critical" | undefined; + }, { +- type: import("superstruct").Struct; +- variant: import("superstruct").Struct<"default" | "warning" | "critical" | undefined, null>; +- label: import("superstruct").Struct; +- value: import("superstruct").Struct<{ ++ type: import("@metamask/superstruct").Struct; ++ variant: import("@metamask/superstruct").Struct<"default" | "warning" | "critical" | undefined, null>; ++ label: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct<{ + value: string; + type: NodeType.Image; + } | { +diff --git a/dist/types/ui/components/spinner.d.ts b/dist/types/ui/components/spinner.d.ts +index da3ab733eb22ce714cb7060130cb48ee05e6890a..6e1f57718b358b36d451e5cbbed09c8ab0799c14 100644 +--- a/dist/types/ui/components/spinner.d.ts ++++ b/dist/types/ui/components/spinner.d.ts +@@ -1,9 +1,9 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const SpinnerStruct: import("superstruct").Struct<{ ++export declare const SpinnerStruct: import("@metamask/superstruct").Struct<{ + type: NodeType.Spinner; + }, { +- type: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; + }>; + /** + * A spinner node, that renders a spinner, either as a full-screen overlay, or +diff --git a/dist/types/ui/components/text.d.ts b/dist/types/ui/components/text.d.ts +index 9b2b9531277adde01591a71909718c5f4f172173..711b43681686983b310999c4d0fc59537fc1c8de 100644 +--- a/dist/types/ui/components/text.d.ts ++++ b/dist/types/ui/components/text.d.ts +@@ -1,13 +1,13 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import { NodeType } from '../nodes'; +-export declare const TextStruct: import("superstruct").Struct<{ ++export declare const TextStruct: import("@metamask/superstruct").Struct<{ + value: string; + type: NodeType.Text; + markdown?: boolean | undefined; + }, { +- type: import("superstruct").Struct; +- value: import("superstruct").Struct; +- markdown: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; ++ markdown: import("@metamask/superstruct").Struct; + }>; + /** + * A text node, that renders the text as one or more paragraphs. +diff --git a/dist/types/ui/nodes.d.ts b/dist/types/ui/nodes.d.ts +index f1d76b68a43850f65ebf645f69d34247e6ed6b7b..dc1da5ba43f20aba1d7f5c4b84ee7ca56a73ec38 100644 +--- a/dist/types/ui/nodes.d.ts ++++ b/dist/types/ui/nodes.d.ts +@@ -1,4 +1,4 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + /** + * The supported node types. This is based on SIP-7. + * +@@ -21,10 +21,10 @@ export declare enum NodeType { + /** + * @internal + */ +-export declare const NodeStruct: import("superstruct").Struct<{ ++export declare const NodeStruct: import("@metamask/superstruct").Struct<{ + type: string; + }, { +- type: import("superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; + }>; + /** + * The base node type. All nodes extend this type. +@@ -37,12 +37,12 @@ export declare type Node = Infer; + /** + * @internal + */ +-export declare const LiteralStruct: import("superstruct").Struct<{ ++export declare const LiteralStruct: import("@metamask/superstruct").Struct<{ + value: unknown; + type: string; + }, { +- value: import("superstruct").Struct; +- type: import("superstruct").Struct; ++ value: import("@metamask/superstruct").Struct; ++ type: import("@metamask/superstruct").Struct; + }>; + /** + * A node with a value. This is used for nodes that render a value, such as +diff --git a/package.json b/package.json +index c78de173e59c45bdeb07cd4a19b31a328d2b6bef..706e553b6079739e6fb9740e96bb36a80154b0be 100644 +--- a/package.json ++++ b/package.json +@@ -58,12 +58,15 @@ + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" + }, ++ "resolutions": { ++ "@metamask/superstruct": "3.1.0" ++ }, + "dependencies": { + "@metamask/key-tree": "^9.1.1", + "@metamask/providers": "^17.0.0", + "@metamask/rpc-errors": "^6.2.1", +- "@metamask/utils": "^8.3.0", +- "superstruct": "^1.0.3" ++ "@metamask/superstruct": "^3.1.0", ++ "@metamask/utils": "^8.3.0" + }, + "devDependencies": { + "@lavamoat/allow-scripts": "^3.0.4", diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch new file mode 100644 index 0000000000..b159e34010 --- /dev/null +++ b/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch @@ -0,0 +1,702 @@ +diff --git a/dist/chunk-2LBN5T56.js.map b/dist/chunk-2LBN5T56.js.map +index 99c2b450d36f7c800c2ed82784b30384e0ace616..efcb2d6787d9547511f94717b32f467a28413d70 100644 +--- a/dist/chunk-2LBN5T56.js.map ++++ b/dist/chunk-2LBN5T56.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/cronjob.ts"],"names":[],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF","sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from 'superstruct';\nimport { array, create, object, optional, refine, string } from 'superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/cronjob.ts"],"names":[],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF","sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, create, object, optional, refine, string } from '@metamask/superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-37VHIRUJ.js.map b/dist/chunk-37VHIRUJ.js.map +index 0307f6d55851cc9ba627142bfc2548e4b416a719..cc92acbd998d37f18246969d0d55557ff5765862 100644 +--- a/dist/chunk-37VHIRUJ.js.map ++++ b/dist/chunk-37VHIRUJ.js.map +@@ -1 +1 @@ +-{"version":3,"sources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AQ;AACzC,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,mBAAmB,OAAO;AACxC,SAAO,MAAM,KAAK,MAAM;AAC1B;AAUO,SAAS,gBACd,SACA,aACA,QACA;AAEA,MAAI,WAAW,YAAY;AACzB,WAAO;AAAA,EACT;AAGA,MACE,QAAQ,gBAAgB;AAAA,IAAK,CAAC,YAC5B,mBAAmB,SAAS,MAAM;AAAA,EACpC,GACA;AACA,WAAO;AAAA,EACT;AAGA,MAAI,gBAAgB,YAAY,WAAW,QAAQ,OAAO;AACxD,WAAO;AAAA,EACT;AAGA,SAAO,QAAQ,gBAAgB,YAAY,QAAQ,QAAQ,KAAK;AAClE;AAUO,SAAS,uBACd,OACuC;AACvC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B,MAAM,MAAM,OAAO,EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF","sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { array, boolean, object, optional, refine, string } from 'superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/json-rpc.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAu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,EACT;AAGA,MACE,QAAQ,gBAAgB;AAAA,IAAK,CAAC,YAC5B,mBAAmB,SAAS,MAAM;AAAA,EACpC,GACA;AACA,WAAO;AAAA,EACT;AAGA,MAAI,gBAAgB,YAAY,WAAW,QAAQ,OAAO;AACxD,WAAO;AAAA,EACT;AAGA,SAAO,QAAQ,gBAAgB,YAAY,QAAQ,QAAQ,KAAK;AAClE;AAUO,SAAS,uBACd,OACuC;AACvC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B,MAAM,MAAM,OAAO,EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF","sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, object, optional, refine, string } from '@metamask/superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-6LOYTBS3.js.map b/dist/chunk-6LOYTBS3.js.map +index 1dc000f46ea5a9a9d19a5980c8dd35700eeaabed..affde50fa3963a1c1a2236cc4ddf41a74aed7267 100644 +--- a/dist/chunk-6LOYTBS3.js.map ++++ b/dist/chunk-6LOYTBS3.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/namespace.ts"],"names":[],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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AS/D,SAAS,cAAc,OAAsC;AAClE,SAAO,GAAG,OAAO,iBAAiB;AACpC;AAQO,SAAS,UAAU,OAAkC;AAC1D,SAAO,GAAG,OAAO,aAAa;AAChC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,GAAG,OAAO,oBAAoB;AACvC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC","sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from 'superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/namespace.ts"],"names":[],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,SAAO;AAAA,IACL,WAAW,MAAM,OAAO;AAAA,IACxB,WAAW,MAAM,OAAO;AAAA,EAC1B;AACF;AASO,SAAS,eAAe,WAI7B;AACA,QAAM,QAAQ,iBAAiB,KAAK,SAAS;AAC7C,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,SAAO;AAAA,IACL,SAAS,MAAM,OAAO;AAAA,IACtB,SAAS,MAAM,OAAO;AAAA,IACtB,OAAO;AAAA,MACL,WAAW,MAAM,OAAO;AAAA,MACxB,WAAW,MAAM,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAMO,IAAM,gBAAgB,KAAK,OAAO,GAAG,GAAG,EAAE;AAE1C,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA,OAAO,EAAE;AACX;AAKO,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AACF;AAIO,IAAM,kBAAkB,QAAQ,OAAO,GAAG,gBAAgB;AAE1D,IAAM,uBAAuB,MAAM,eAAe;AAClD,IAAM,uBAAuB,QAAQ,OAAO,GAAG,qBAAqB;AAMpE,IAAM,cAAc,OAAO;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AACR,CAAC;AAGM,IAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA,EAIpC,QAAQ,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA,EAKzB,SAAS,SAAS,MAAM,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA,EAKtC,QAAQ,SAAS,MAAM,aAAa,CAAC;AACvC,CAAC;AAMM,IAAM,oBAAoB,QAAQ,OAAO,GAAG,mBAAmB;AAS/D,SAAS,cAAc,OAAsC;AAClE,SAAO,GAAG,OAAO,iBAAiB;AACpC;AAQO,SAAS,UAAU,OAAkC;AAC1D,SAAO,GAAG,OAAO,aAAa;AAChC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,GAAG,OAAO,oBAAoB;AACvC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC","sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from '@metamask/superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-CMOSYNZR.js.map b/dist/chunk-CMOSYNZR.js.map +index 22b53573f3f36f6188cd83ed9a17139cd433afe6..84c783e8a7d742c9a8225fc33a0201f5a552f115 100644 +--- a/dist/chunk-CMOSYNZR.js.map ++++ b/dist/chunk-CMOSYNZR.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/types.ts"],"names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OACL;AAQA,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,iBAAc;AACd,EAAAA,kBAAA,cAAW;AAFD,SAAAA;AAAA,GAAA;AAKL,IAAM,aAAa;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP;AAAA,EACF;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,2BAA2B,KAAK;AAAA,EAC3C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM,SAAS,KAAK,OAAO,GAAG,GAAG,QAAQ,CAAC;AAAA,EAC1C,YAAY;AAAA,IACV,OAAO;AAAA,MACL,MAAM,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,MAChC,KAAK,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,IACjC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,qBACd,OAC6B;AAC7B,SAAO,GAAG,OAAO,wBAAwB;AAC3C;AAQO,SAAS,2BACd,OACqC;AACrC;AAAA,IACE;AAAA,IACA;AAAA,IACA,IAAI,gCAA4B;AAAA,EAClC;AACF;AAuCO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;AAUL,IAAK,8BAAL,kBAAKC,iCAAL;AACL,EAAAA,6BAAA,kBAAe;AACf,EAAAA,6BAAA,qBAAkB;AAClB,EAAAA,6BAAA,wBAAqB;AACrB,EAAAA,6BAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAQL,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,cAAW;AACX,EAAAA,mBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;AAwBL,IAAM,MAAM,CAAC,OAAwB,CAAC,MAC3C,OAAO,MAAM,CAAC,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU;AACzD,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,KAAK;AAEzB,UAAM,YAAY,KAAK,IAAI;AAC3B,sBAAkB,KAAK,SAAS;AAChC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,sBAAsB,MAAM,SAAS,CAAC;AAAA,EAC/C;AACF,CAAC;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from 'superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/types.ts"],"names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,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I,IAAI,KAAK;AAEzB,UAAM,YAAY,KAAK,IAAI;AAC3B,sBAAkB,KAAK,SAAS;AAChC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,sBAAsB,MAAM,SAAS,CAAC;AAAA,EAC/C;AACF,CAAC;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from '@metamask/superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"]} +\ No newline at end of file +diff --git a/dist/chunk-EA2FOAEG.mjs.map b/dist/chunk-EA2FOAEG.mjs.map +index 3adeaad438828651cc310b1e083d5d2621ba2dd0..1691a2a3457b49ca2b255df881915dbd86e08d84 100644 +--- a/dist/chunk-EA2FOAEG.mjs.map ++++ b/dist/chunk-EA2FOAEG.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/cronjob.ts"],"sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from 'superstruct';\nimport { array, create, object, optional, refine, string } from 'superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/cronjob.ts"],"sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, create, object, optional, refine, string } from '@metamask/superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-EXEEDJ6N.mjs.map b/dist/chunk-EXEEDJ6N.mjs.map +index b8d03c6d15edaae1badb0358c2b528c4308fc54b..6dc21bd6f368c78e657052012e043221a90602e5 100644 +--- a/dist/chunk-EXEEDJ6N.mjs.map ++++ b/dist/chunk-EXEEDJ6N.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/manifest/validation.ts"],"sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from 'superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from 'superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,IAAM,qBAA+B;AAAA,EACnC;AAAA,EACA;AACF;AAEO,IAAM,uBAAiC,CAAC,EAAE;AACjD,IAAM,kBAA8B,qBAAqB,IAAI,CAAC,aAAa;AAAA,EACzE;AAAA,EACA;AAAA,EACA,GAAG,QAAQ;AACb,CAAC;AAEM,IAAM,kBAAkB;AAAA,EAC7B,MAAM,OAAO,CAAC;AAAA,EACd;AAAA,EACA,CAAC,SAAmB;AAClB,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,Q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cAAc,KAAK,OAAO,GAAG,GAAG,GAAG;AAAA,EACnC,YAAY;AAAA,IACV,OAAO;AAAA,MACL,MAAM,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,MAChC,KAAK,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,IACjC,CAAC;AAAA,EACH;AAAA,EACA,QAAQ,OAAO;AAAA,IACb,QAAQ;AAAA,IACR,UAAU,OAAO;AAAA,MACf,KAAK,OAAO;AAAA,QACV,UAAU,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,QACpC,UAAU,SAAS,KAAK,OAAO,GAAG,GAAG,QAAQ,CAAC;AAAA,QAC9C,aAAa;AAAA,QACb,UAAU,MAAM;AAAA,UACd,QAAQ,4BAA4B;AAAA,UACpC,QAAQ,6BAA6B;AAAA,QACvC,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,IACD,OAAO,SAAS,uBAAuB;AAAA,IACvC,SAAS,SAAS,uBAAuB;AAAA,EAC3C,CAAC;AAAA,EACD,oBAAoB,SAAS,wBAAwB;AAAA,EACrD,oBAAoB;AAAA,EACpB,iBAAiB,QAAQ,KAAK;AAAA,EAC9B,SAAS,SAAS,OAAO,CAAC;AAAA;AAC5B,CAAC;AAUM,SAAS,eAAe,OAAuC;AACpE,SAAO,GAAG,OAAO,kBAAkB;AACrC;AAQO,SAAS,qBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/manifest/validation.ts"],"sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from '@metamask/superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\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,uBAAuB;AAAA,IACvC,SAAS,SAAS,uBAAuB;AAAA,EAC3C,CAAC;AAAA,EACD,oBAAoB,SAAS,wBAAwB;AAAA,EACrD,oBAAoB;AAAA,EACpB,iBAAiB,QAAQ,KAAK;AAAA,EAC9B,SAAS,SAAS,OAAO,CAAC;AAAA;AAC5B,CAAC;AAUM,SAAS,eAAe,OAAuC;AACpE,SAAO,GAAG,OAAO,kBAAkB;AACrC;AAQO,SAAS,qBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-EXUEHPZ4.mjs.map b/dist/chunk-EXUEHPZ4.mjs.map +index c5e8ed710eea502b656b5f16aa6033ba3bf36c3b..82a2348db4c0b015ce94fbb14ece4a1baf72797e 100644 +--- a/dist/chunk-EXUEHPZ4.mjs.map ++++ b/dist/chunk-EXUEHPZ4.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/namespace.ts"],"sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from 'superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,SAAO;AAAA,IACL,WAAW,MAAM,OAAO;AAAA,IACxB,WAAW,MAAM,OAAO;AAAA,EAC1B;AACF;AASO,SAAS,eAAe,WAI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;AAClC;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/namespace.ts"],"sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from '@metamask/superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,SAAO;AAAA,IACL,WAAW,MAAM,OAAO;AAAA,IACxB,WAAW,MAAM,OAAO;AAAA,EAC1B;AACF;AASO,SAAS,eAAe,WAI7B;AACA,QAAM,QAAQ,iBAAiB,KAAK,SAAS;AAC7C,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,SAAO;AAAA,IACL,SAAS,MAAM,OAAO;AAAA,IACtB,SAAS,MAAM,OAAO;AAAA,IACtB,OAAO;AAAA,MACL,WAAW,MAAM,OAAO;AAAA,MACxB,WAAW,MAAM,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAMO,IAAM,gBAAgB,KAAK,OAAO,GAAG,GAAG,EAAE;AAE1C,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA,OAAO,EAAE;AACX;AAKO,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AACF;AAIO,IAAM,kBAAkB,QAAQ,OAAO,GAAG,gBAAgB;AAE1D,IAAM,uBAAuB,MAAM,eAAe;AAClD,IAAM,uBAAuB,QAAQ,OAAO,GAAG,qBAAqB;AAMpE,IAAM,cAAc,OAAO;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AACR,CAAC;AAGM,IAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA,EAIpC,QAAQ,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA,EAKzB,SAAS,SAAS,MAAM,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA,EAKtC,QAAQ,SAAS,MAAM,aAAa,CAAC;AACvC,CAAC;AAMM,IAAM,oBAAoB,QAAQ,OAAO,GAAG,mBAAmB;AAS/D,SAAS,cAAc,OAAsC;AAClE,SAAO,GAAG,OAAO,iBAAiB;AACpC;AAQO,SAAS,UAAU,OAAkC;AAC1D,SAAO,GAAG,OAAO,aAAa;AAChC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,GAAG,OAAO,oBAAoB;AACvC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-HEXZ4DFV.js.map b/dist/chunk-HEXZ4DFV.js.map +index e6afcd73012f02f53fb24de0d5776a240c98e82b..37583b7ac1951b880ac7c349b6dce71162345946 100644 +--- a/dist/chunk-HEXZ4DFV.js.map ++++ b/dist/chunk-HEXZ4DFV.js.map +@@ -1 +1,11 @@ +-{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,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BAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;AA+DO,SAAS,gBAAgB,SAAqC;AACnE,QAAM,eAAgB;AAAA,IACpB,GAAG;AAAA,EACL;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,CAAC,QAAQ,OAAO,KAAK;AACnB,iBAAW,UAAU,SAAS;AAC5B,eAAO,OAAO,QAAQ,OAAO,GAAG;AAAA,MAClC;AAAA,IACF;AAAA,EACF,CAAC;AACH","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from 'superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n"]} +\ No newline at end of file ++{ ++ "version": 3, ++ "sources": [ ++ "../src/structs.ts" ++ ], ++ "names": [], ++ "mappings": ";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;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NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from '@metamask/superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from '@metamask/superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n" ++ ] ++} +\ No newline at end of file +diff --git a/dist/chunk-I4TRH6VO.mjs.map b/dist/chunk-I4TRH6VO.mjs.map +index 5d7641083396d9fa2a352e4a62afa213975e00a1..64ca8fe5a65a041316a740aba0cc9adbf0db2895 100644 +--- a/dist/chunk-I4TRH6VO.mjs.map ++++ b/dist/chunk-I4TRH6VO.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/handlers.ts"],"sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from 'superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,oCAA0B,GAAG;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA4D;AACtE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,a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AsC,OAAO;AAAA,EACxD,SAAS;AACX,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,IAAI,OAAO;AACb,CAAC;AAEM,IAAM,2BAA2B,MAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,0BAA0B,OAAO;AAAA,EAC5C,UAAU,OAAO;AAAA,EACjB,gBAAgB,OAAO;AACzB,CAAC;AAEM,IAAM,yBAAyB,OAAO;AAAA,EAC3C,UAAU,OAAO;AAAA,EACjB,iBAAiB,OAAO;AAAA,EACxB,YAAY,OAAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/handlers.ts"],"sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from '@metamask/superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OA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;AAEO,IAAM,sCAAsC,OAAO;AAAA,EACxD,UAAU,SAAS,QAAQ,cAAc,QAAQ,CAAC;AACpD,CAAC;AAEM,IAAM,oCAAoC;AAAA,EAC/C;AAAA,EACA,OAAO;AAAA,IACL,IAAI,OAAO;AAAA,EACb,CAAC;AACH;AAEO,IAAM,yCAAyC;AAAA,EACpD;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,EACX,CAAC;AACH;AAEO,IAAM,8BAA8B;AAAA,EACzC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEO,IAAM,4BAA4B;AAElC,IAAM,sCAAsC,OAAO;AAAA,EACxD,SAAS;AACX,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,IAAI,OAAO;AACb,CAAC;AAEM,IAAM,2BAA2B,MAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,0BAA0B,OAAO;AAAA,EAC5C,UAAU,OAAO;AAAA,EACjB,gBAAgB,OAAO;AACzB,CAAC;AAEM,IAAM,yBAAyB,OAAO;AAAA,EAC3C,UAAU,OAAO;AAAA,EACjB,iBAAiB,OAAO;AAAA,EACxB,YAAY,OAAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-IPOE62V4.js.map b/dist/chunk-IPOE62V4.js.map +index ae0c17642528a2a26f624224291b4ef320640d4b..4453253634d79c30fea46a29340454f16f71c2ee 100644 +--- a/dist/chunk-IPOE62V4.js.map ++++ b/dist/chunk-IPOE62V4.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/versions.ts"],"names":[],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C","sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from 'superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/versions.ts"],"names":[],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C","sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from '@metamask/superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-K2OTEZZZ.mjs.map b/dist/chunk-K2OTEZZZ.mjs.map +index b623c2ab78896142fbff273a9813822161439244..a9fcc0f68061a1d9df5235806eea7b4d0cfdbf50 100644 +--- a/dist/chunk-K2OTEZZZ.mjs.map ++++ b/dist/chunk-K2OTEZZZ.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/json-rpc.ts"],"sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { array, boolean, object, optional, refine, string } from 'superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAuB;AAAA,EAC3B,OAAO,OAAO,GAAG,kBAAkB,CAAC,UAAU;AAC5C,UAAM,YAAY,MAAM,MAAM,GAAG,EAAE,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A,WAAO;AAAA,EACT;AAGA,MAAI,gBAAgB,YAAY,WAAW,QAAQ,OAAO;AACxD,WAAO;AAAA,EACT;AAGA,SAAO,QAAQ,gBAAgB,YAAY,QAAQ,QAAQ,KAAK;AAClE;AAUO,SAAS,uBACd,OACuC;AACvC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B,MAAM,MAAM,OAAO,EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/json-rpc.ts"],"sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, object, optional, refine, string } from '@metamask/superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAuB;AAAA,EAC3B,OAAO,OAAO,GAAG,kBAAkB,CAAC,UAAU;AAC5C,UAAM,YAAY,MAAM,MAAM,GAAG,EAAE,SAAS;AAC5C,QAAI,YAAY,GAAG;AACjB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,mBAAmB;AAAA,EAC9B,OAAO;AAAA,IACL,OAAO,SAAS,QAAQ,CAA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BACd,OACuC;AACvC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B,MAAM,MAAM,OAAO,EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-K4B37F3L.js.map b/dist/chunk-K4B37F3L.js.map +index bb47f82ae64b7c323a9e436e60611a30557544d1..5f353c3538fd5408070be0294c934309621dccdc 100644 +--- a/dist/chunk-K4B37F3L.js.map ++++ b/dist/chunk-K4B37F3L.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/snaps.ts"],"names":["SnapStatus","SnapStatusEvents"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+GL,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAG1D,YAAY,SAAiB,QAAqC;AAChE,UAAM,OAAO;AACb,SAAK,SAAS;AAAA,EAChB;AACF;AAQA,SAAS,yBACP,UACa;AACb,QAAM,eAAe,SAAS,MAAM;AACp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,KAAK,CAAC,GACN,QACA,MAAM;AAAA,EACZ;AACF;AASO,SAAS,+BACd,sBACwD;AACxD;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,aAAa,qBAAqB,IAAI;AAE9C;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,QAAQ,IAAI;AAEpB;AAAA,IACE,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW;AAAA,IAC7C;AAAA,EACF;AAEA,QAAM,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF","sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from 'superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from 'superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/snaps.ts"],"names":["SnapStatus","SnapStatusEvents"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+GL,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAG1D,YAAY,SAAiB,QAAqC;AAChE,UAAM,OAAO;A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,QACA;AACA,SAAO;AAAA,KAGA,aAAa,aAAa,SAAS;AAAA,MAClC,CAAC,WAAW,OAAO;AAAA,IACrB,KAAK,CAAC,GACN,QACA,MAAM;AAAA,EACZ;AACF;AASO,SAAS,+BACd,sBACwD;AACxD;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,aAAa,qBAAqB,IAAI;AAE9C;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,QAAQ,IAAI;AAEpB;AAAA,IACE,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW;AAAA,IAC7C;AAAA,EACF;AAEA,QAAM,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF","sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from '@metamask/superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from '@metamask/superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"]} +\ No newline at end of file +diff --git a/dist/chunk-NHGIT2SZ.mjs.map b/dist/chunk-NHGIT2SZ.mjs.map +index 120c6ed6c981ea15ce54af2ee50e3606a95a7c18..08b57cf5253fe0bb5f9a7153d832ce5e1a3dc030 100644 +--- a/dist/chunk-NHGIT2SZ.mjs.map ++++ b/dist/chunk-NHGIT2SZ.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from 'superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,M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D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;AA+DO,SAAS,gBAAgB,SAAqC;AACnE,QAAM,eAAgB;AAAA,IACpB,GAAG;AAAA,EACL;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,CAAC,QAAQ,OAAO,KAAK;AACnB,iBAAW,UAAU,SAAS;AAC5B,eAAO,OAAO,QAAQ,OAAO,GAAG;AAAA,MAClC;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from '@metamask/superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from '@metamask/superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA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end of file +diff --git a/dist/chunk-OJM2SKJZ.js.map b/dist/chunk-OJM2SKJZ.js.map +index a622c3eb7b64f74286be6ef92c07d0d979a06390..19e60107094e01124b389f80675aa40b70e538e8 100644 +--- a/dist/chunk-OJM2SKJZ.js.map ++++ b/dist/chunk-OJM2SKJZ.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/handlers.ts"],"names":[],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,oCAA0B,GAAG;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA4D;AACtE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,0BAAqB,GAAG;AAAA,IACtB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAuD;AACjE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,0CAA6B,GAA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O;AAAA,EACxB,YAAY,OAAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE","sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from 'superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/handlers.ts"],"names":[],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,oCAA0B,GAAG;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA4D;AACtE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kCAAyB,GAAG;AAAA,IAC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AAAA,EACF,CAAC;AACH;AAEO,IAAM,4BAA4B;AAElC,IAAM,sCAAsC,OAAO;AAAA,EACxD,SAAS;AACX,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,IAAI,OAAO;AACb,CAAC;AAEM,IAAM,2BAA2B,MAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,0BAA0B,OAAO;AAAA,EAC5C,UAAU,OAAO;AAAA,EACjB,gBAAgB,OAAO;AACzB,CAAC;AAEM,IAAM,yBAAyB,OAAO;AAAA,EAC3C,UAAU,OAAO;AAAA,EACjB,iBAAiB,OAAO;AAAA,EACxB,YAAY,OAAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE","sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from '@metamask/superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"]} +\ No newline at end of file +diff --git a/dist/chunk-R5DO7T2D.js.map b/dist/chunk-R5DO7T2D.js.map +index b390f18cbf1b3e55bd82fc01c337ed068a12973e..48f29fe714b4dd41823c5e16b40bf400ec7d013d 100644 +--- a/dist/chunk-R5DO7T2D.js.map ++++ b/dist/chunk-R5DO7T2D.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/localization.ts"],"names":[],"mappings":";;;;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,QACR,wBAAwB,KAAK;AAAA,MAC/B;AAAA,IACF;AAEA,UAAM,cAAc,KAAK,SAAS,IAAI,KAAK,CAAC;AAC5C,QAAI,CAAC,aAAa;AAChB,YAAM,IAAI;AAAA,QACR,wBAAwB,KAAK,gCAAgC,IAAI,KAAK,CAAC,SACrE,KAAK,MACP;AAAA,MACF;AAAA,IACF;AAEA,WAAO,OAAO,QAAQ,OAAO,YAAY,OAAO;AAAA,EAClD,GAAG,KAAK;AACV;AAWO,SAAS,yBACd,cACA,QACA,mBACA;AACA,QAAM,OAAO,oBAAoB,QAAQ,iBAAiB;AAE1D,SAAO,mBAAmB,OAAO,CAAC,UAAU,UAAU;AACpD,UAAM,cAAc,UAAU,SAAS,KAAK,GAAG,IAAI;AACnD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,KAAK,GAAG;AAAA,IACX;AAAA,EACF,GAAG,YAAY;AACjB;AASO,SAAS,kCACd,cACA,mBACA;AACA,MAAI;AAGF,sBACG,OAAO,CAAC,SAAS,KAAK,WAAW,IAAI,EACrC,QAAQ,CAAC,SAAS;AACjB,+BAAyB,cAAc,KAAK,QAAQ,iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from 'superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/localization.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OAAO,CAAC;AAAA,IAChC,CAAC;AAAA,EACH;AACF,CAA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AAO,oBAAoB,QAAQ,iBAAiB;AAE1D,SAAO,mBAAmB,OAAO,CAAC,UAAU,UAAU;AACpD,UAAM,cAAc,UAAU,SAAS,KAAK,GAAG,IAAI;AACnD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,KAAK,GAAG;AAAA,IACX;AAAA,EACF,GAAG,YAAY;AACjB;AASO,SAAS,kCACd,cACA,mBACA;AACA,MAAI;AAGF,sBACG,OAAO,CAAC,SAAS,KAAK,WAAW,IAAI,EACrC,QAAQ,CAAC,SAAS;AACjB,+BAAyB,cAAc,KAAK,QAAQ,iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from '@metamask/superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"]} +\ No newline at end of file +diff --git a/dist/chunk-T6FWIDA6.mjs.map b/dist/chunk-T6FWIDA6.mjs.map +index be6d80b92f7a57482e3338b4ca61efbe9707ea83..d32530db73b52bece342442d8fe86fe3edb69219 100644 +--- a/dist/chunk-T6FWIDA6.mjs.map ++++ b/dist/chunk-T6FWIDA6.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from 'superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;A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AC,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU;AACzD,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,KAAK;AAEzB,UAAM,YAAY,KAAK,IAAI;AAC3B,sBAAkB,KAAK,SAAS;AAChC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,sBAAsB,MAAM,SAAS,CAAC;AAAA,EAC/C;AACF,CAAC;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B;","names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"]} +\ No newline at end of file ++{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from '@metamask/superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OACL;AAQA,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,iBAAc;AACd,EAAAA,kBAAA,cAAW;AAFD,SAAAA;AAAA,GAAA;AAKL,IAAM,aAAa;AAAA,EACxB;AAAA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;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B;","names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"]} +\ No newline at end of file +diff --git a/dist/chunk-UMZNVWEM.mjs.map b/dist/chunk-UMZNVWEM.mjs.map +index 068c800d29873541cc45a70b944c837e5721e8dc..6acac0bb8bc9dce262d6e17e4057a2b7ba2dad3f 100644 +--- a/dist/chunk-UMZNVWEM.mjs.map ++++ b/dist/chunk-UMZNVWEM.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/versions.ts"],"sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from 'superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/versions.ts"],"sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from '@metamask/superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-WZ457PEQ.mjs.map b/dist/chunk-WZ457PEQ.mjs.map +index 033c5aadae4bede2958eeb2331507609b3650588..b958605e41d54d9979bb8f84fecaedc41c711d95 100644 +--- a/dist/chunk-WZ457PEQ.mjs.map ++++ b/dist/chunk-WZ457PEQ.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/localization.ts"],"sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from 'superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OA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;AAWO,SAAS,yBACd,cACA,QACA,mBACA;AACA,QAAM,OAAO,oBAAoB,QAAQ,iBAAiB;AAE1D,SAAO,mBAAmB,OAAO,CAAC,UAAU,UAAU;AACpD,UAAM,cAAc,UAAU,SAAS,KAAK,GAAG,IAAI;AACnD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,KAAK,GAAG;AAAA,IACX;AAAA,EACF,GAAG,YAAY;AACjB;AASO,SAAS,kCACd,cACA,mBACA;AACA,MAAI;AAGF,sBACG,OAAO,CAAC,SAAS,KAAK,WAAW,IAAI,EACrC,QAAQ,CAAC,SAAS;AACjB,+BAAyB,cAAc,KAAK,QAAQ,iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;","names":[]} +\ No newline at end of file ++{"version":3,"sources":["../src/localization.ts"],"sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from '@metamask/superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OAAO,CAAC;AAAA,IAChC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,8BACd,mBACiC;AACjC,aAAW,QAAQ,mBAAmB;AACpC,QAAI;AACF,WAAK,SAAS,OAAO,UAAU,KAAK,SAAS,CAAC,GAAG,sBAAsB;AAAA,IACzE,SAAS,OAAO;AACd,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,yCAAyC,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,QACvE;AAAA,MACF;AAEA,UAAI,iBAAi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S,KAAK,WAAW,IAAI,EACrC,QAAQ,CAAC,SAAS;AACjB,+BAAyB,cAAc,KAAK,QAAQ,iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;","names":[]} +\ No newline at end of file +diff --git a/dist/chunk-YCIPY3UP.mjs.map b/dist/chunk-YCIPY3UP.mjs.map +index 5321ffd13eb7a88be2952f1e156cd774d5e9444b..5ba5fe5846aa56f87e227efea27ce2ae9138f0bc 100644 +--- a/dist/chunk-YCIPY3UP.mjs.map ++++ b/dist/chunk-YCIPY3UP.mjs.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/snaps.ts"],"sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from 'superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from 'superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+GL,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAG1D,YAAY,SAAiB,QAAqC;AAChE,UAAM,OAAO;AACb,SAAK,SAAS;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;AAAA,KAGA,aAAa,aAAa,SAAS;AAAA,MAClC,CAAC,WAAW,OAAO;AAAA,IACrB,KAAK,CAAC,GACN,QACA,MAAM;AAAA,EACZ;AACF;AASO,SAAS,+BACd,sBACwD;AACxD;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,aAAa,qBAAqB,IAAI;AAE9C;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,QAAQ,IAAI;AAEpB;AAAA,IACE,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW;AAAA,IAC7C;AAAA,EACF;AAEA,QAAM,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF;","names":["SnapStatus","SnapStatusEvents"]} +\ No newline at end of file ++{"version":3,"sources":["../src/snaps.ts"],"sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from '@metamask/superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from '@metamask/superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+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,SACE,OAAO,YAAY,YACnB,mEAAmE;AAAA,IACjE;AAAA,EACF;AAEJ;AASO,SAAS,gBACd,aACA,QACA;AACA,SAAO;AAAA,KAGA,aAAa,aAAa,SAAS;AAAA,MAClC,CAAC,WAAW,OAAO;AAAA,IACrB,KAAK,CAAC,GACN,QACA,MAAM;AAAA,EACZ;AACF;AASO,SAAS,+BACd,sBACwD;AACxD;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,aAAa,qBAAqB,IAAI;AAE9C;AAAA,IACE,SAAS,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,QAAQ,IAAI;AAEpB;AAAA,IACE,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW;AAAA,IAC7C;AAAA,EACF;AAEA,QAAM,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF;","names":["SnapStatus","SnapStatusEvents"]} +\ No newline at end of file +diff --git a/dist/chunk-ZJKG5Q2C.js.map b/dist/chunk-ZJKG5Q2C.js.map +index 913794892e5f673c8d0c13691e6c3f6429d14867..fd057e45b69a442d17b721703c2f57dda2f817c5 100644 +--- a/dist/chunk-ZJKG5Q2C.js.map ++++ b/dist/chunk-ZJKG5Q2C.js.map +@@ -1 +1 @@ +-{"version":3,"sources":["../src/manifest/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from 'superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from 'superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"]} +\ No newline at end of file ++{"version":3,"sources":["../src/manifest/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,IAAM,qBAA+B;AAAA,EACnC;AAAA,EACA;AACF;AAEO,IAAM,uBAAiC,CAAC,EAAE;AACjD,IAAM,kBAA8B,qBAAqB,IAAI,CAAC,aAAa;AAAA,EACzE;AAAA,EACA;AAAA,EACA,GAAG,QAAQ;AACb,CAAC;AAEM,IAAM,kBAAkB;AAAA,EAC7B,MAAM,OAAO,CAAC;AAAA,EACd;AAAA,EACA,CAAC,SAAmB;AAClB,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,CAAC,MAAM,KAAK;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,SAAS,GAAG;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,wBAAwB,IAAI,CAAC,GAAG;AAChE,aAAO;AAAA,IACT;AAEA,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;AAAA,IACb,QAAQ;AAAA,IACR,UAAU,OAAO;AAAA,MACf,KAAK,OAAO;AAAA,QACV,UAAU,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,QACpC,UAAU,SAAS,KAAK,OAAO,GAAG,GAAG,QAAQ,CAAC;AAAA,QAC9C,aAAa;AAAA,QACb,UAAU,MAAM;AAAA,UACd,QAAQ,4BAA4B;AAAA,UACpC,QAAQ,6BAA6B;AAAA,QACvC,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,IACD,OAAO,SAAS,uBAAuB;AAAA,IACvC,SAAS,SAAS,uBAAuB;AAAA,EAC3C,CAAC;AAAA,EACD,oBAAoB,SAAS,wBAAwB;AAAA,EACrD,oBAAoB;AAAA,EACpB,iBAAiB,QAAQ,KAAK;AAAA,EAC9B,SAAS,SAAS,OAAO,CAAC;AAAA;AAC5B,CAAC;AAUM,SAAS,eAAe,OAAuC;AACpE,SAAO,GAAG,OAAO,kBAAkB;AACrC;AAQO,SAAS,qBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from '@metamask/superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"]} +\ No newline at end of file +diff --git a/dist/types/cronjob.d.ts b/dist/types/cronjob.d.ts +index bbd2e815e1a5291aa4e4424092f0733de29a9615..ba11906cdfc68042627ed2a7cc077ce397586f23 100644 +--- a/dist/types/cronjob.d.ts ++++ b/dist/types/cronjob.d.ts +@@ -1,17 +1,17 @@ +-import type { Infer } from 'superstruct'; +-export declare const CronjobRpcRequestStruct: import("superstruct").Struct<{ ++import type { Infer } from '@metamask/superstruct'; ++export declare const CronjobRpcRequestStruct: import("@metamask/superstruct").Struct<{ + method: string; + id?: string | number | null | undefined; + jsonrpc?: "2.0" | undefined; + params?: Record | import("@metamask/utils").Json[] | undefined; + }, { +- jsonrpc: import("superstruct").Struct<"2.0" | undefined, "2.0">; +- id: import("superstruct").Struct; +- method: import("superstruct").Struct; +- params: import("superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; ++ jsonrpc: import("@metamask/superstruct").Struct<"2.0" | undefined, "2.0">; ++ id: import("@metamask/superstruct").Struct; ++ method: import("@metamask/superstruct").Struct; ++ params: import("@metamask/superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; + }>; + export declare type CronjobRpcRequest = Infer; +-export declare const CronExpressionStruct: import("superstruct").Struct; ++export declare const CronExpressionStruct: import("@metamask/superstruct").Struct; + export declare type CronExpression = Infer; + /** + * Parses a cron expression. +@@ -20,7 +20,7 @@ export declare type CronExpression = Infer; + * @returns A CronExpression class instance. + */ + export declare function parseCronExpression(expression: string | object): import("cron-parser").CronExpression; +-export declare const CronjobSpecificationStruct: import("superstruct").Struct<{ ++export declare const CronjobSpecificationStruct: import("@metamask/superstruct").Struct<{ + request: { + method: string; + id?: string | number | null | undefined; +@@ -29,17 +29,17 @@ export declare const CronjobSpecificationStruct: import("superstruct").Struct<{ + }; + expression: string; + }, { +- expression: import("superstruct").Struct; +- request: import("superstruct").Struct<{ ++ expression: import("@metamask/superstruct").Struct; ++ request: import("@metamask/superstruct").Struct<{ + method: string; + id?: string | number | null | undefined; + jsonrpc?: "2.0" | undefined; + params?: Record | import("@metamask/utils").Json[] | undefined; + }, { +- jsonrpc: import("superstruct").Struct<"2.0" | undefined, "2.0">; +- id: import("superstruct").Struct; +- method: import("superstruct").Struct; +- params: import("superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; ++ jsonrpc: import("@metamask/superstruct").Struct<"2.0" | undefined, "2.0">; ++ id: import("@metamask/superstruct").Struct; ++ method: import("@metamask/superstruct").Struct; ++ params: import("@metamask/superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; + }>; + }>; + export declare type CronjobSpecification = Infer; +@@ -50,7 +50,7 @@ export declare type CronjobSpecification = Infer | import("@metamask/utils").Json[] | undefined; + }; + expression: string; +-}[], import("superstruct").Struct<{ ++}[], import("@metamask/superstruct").Struct<{ + request: { + method: string; + id?: string | number | null | undefined; +@@ -67,17 +67,17 @@ export declare const CronjobSpecificationArrayStruct: import("superstruct").Stru + }; + expression: string; + }, { +- expression: import("superstruct").Struct; +- request: import("superstruct").Struct<{ ++ expression: import("@metamask/superstruct").Struct; ++ request: import("@metamask/superstruct").Struct<{ + method: string; + id?: string | number | null | undefined; + jsonrpc?: "2.0" | undefined; + params?: Record | import("@metamask/utils").Json[] | undefined; + }, { +- jsonrpc: import("superstruct").Struct<"2.0" | undefined, "2.0">; +- id: import("superstruct").Struct; +- method: import("superstruct").Struct; +- params: import("superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; ++ jsonrpc: import("@metamask/superstruct").Struct<"2.0" | undefined, "2.0">; ++ id: import("@metamask/superstruct").Struct; ++ method: import("@metamask/superstruct").Struct; ++ params: import("@metamask/superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; + }>; + }>>; + /** +diff --git a/dist/types/handlers.d.ts b/dist/types/handlers.d.ts +index e271e2cf2b00a6c0191fbbd241508a2843245056..51263fb1b8025fe075f1f1a3d9b11cc7a3fb45bc 100644 +--- a/dist/types/handlers.d.ts ++++ b/dist/types/handlers.d.ts +@@ -59,19 +59,19 @@ export declare const SNAP_EXPORTS: { + readonly validator: (snapExport: unknown) => snapExport is OnUserInputHandler; + }; + }; +-export declare const OnTransactionSeverityResponseStruct: import("superstruct").Struct<{ ++export declare const OnTransactionSeverityResponseStruct: import("@metamask/superstruct").Struct<{ + severity?: SeverityLevel | undefined; + }, { +- severity: import("superstruct").Struct; ++ severity: import("@metamask/superstruct").Struct; + }>; +-export declare const OnTransactionResponseWithIdStruct: import("superstruct").Struct<{ ++export declare const OnTransactionResponseWithIdStruct: import("@metamask/superstruct").Struct<{ + id: string; + severity?: SeverityLevel | undefined; + }, { +- id: import("superstruct").Struct; +- severity: import("superstruct").Struct; ++ id: import("@metamask/superstruct").Struct; ++ severity: import("@metamask/superstruct").Struct; + }>; +-export declare const OnTransactionResponseWithContentStruct: import("superstruct").Struct<{ ++export declare const OnTransactionResponseWithContentStruct: import("@metamask/superstruct").Struct<{ + content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { + value: string; + type: import("@metamask/snaps-sdk").NodeType.Copyable; +@@ -148,7 +148,7 @@ export declare const OnTransactionResponseWithContentStruct: import("superstruct + }, "Image">; + severity?: SeverityLevel | undefined; + }, { +- content: import("superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { ++ content: import("@metamask/superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { + value: string; + type: import("@metamask/snaps-sdk").NodeType.Copyable; + sensitive?: boolean | undefined; +@@ -222,9 +222,9 @@ export declare const OnTransactionResponseWithContentStruct: import("superstruct + src: string; + alt?: string | undefined; + }, "Image">, null>; +- severity: import("superstruct").Struct; ++ severity: import("@metamask/superstruct").Struct; + }>; +-export declare const OnTransactionResponseStruct: import("superstruct").Struct<{ ++export declare const OnTransactionResponseStruct: import("@metamask/superstruct").Struct<{ + id: string; + severity?: SeverityLevel | undefined; + } | { +@@ -304,7 +304,7 @@ export declare const OnTransactionResponseStruct: import("superstruct").Struct<{ + }, "Image">; + severity?: SeverityLevel | undefined; + } | null, null>; +-export declare const OnSignatureResponseStruct: import("superstruct").Struct<{ ++export declare const OnSignatureResponseStruct: import("@metamask/superstruct").Struct<{ + id: string; + severity?: SeverityLevel | undefined; + } | { +@@ -384,7 +384,7 @@ export declare const OnSignatureResponseStruct: import("superstruct").Struct<{ + }, "Image">; + severity?: SeverityLevel | undefined; + } | null, null>; +-export declare const OnHomePageResponseWithContentStruct: import("superstruct").Struct<{ ++export declare const OnHomePageResponseWithContentStruct: import("@metamask/superstruct").Struct<{ + content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { + value: string; + type: import("@metamask/snaps-sdk").NodeType.Copyable; +@@ -460,7 +460,7 @@ export declare const OnHomePageResponseWithContentStruct: import("superstruct"). + alt?: string | undefined; + }, "Image">; + }, { +- content: import("superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { ++ content: import("@metamask/superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { + value: string; + type: import("@metamask/snaps-sdk").NodeType.Copyable; + sensitive?: boolean | undefined; +@@ -535,12 +535,12 @@ export declare const OnHomePageResponseWithContentStruct: import("superstruct"). + alt?: string | undefined; + }, "Image">, null>; + }>; +-export declare const OnHomePageResponseWithIdStruct: import("superstruct").Struct<{ ++export declare const OnHomePageResponseWithIdStruct: import("@metamask/superstruct").Struct<{ + id: string; + }, { +- id: import("superstruct").Struct; ++ id: import("@metamask/superstruct").Struct; + }>; +-export declare const OnHomePageResponseStruct: import("superstruct").Struct<{ ++export declare const OnHomePageResponseStruct: import("@metamask/superstruct").Struct<{ + content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { + value: string; + type: import("@metamask/snaps-sdk").NodeType.Copyable; +@@ -618,61 +618,61 @@ export declare const OnHomePageResponseStruct: import("superstruct").Struct<{ + } | { + id: string; + }, null>; +-export declare const AddressResolutionStruct: import("superstruct").Struct<{ ++export declare const AddressResolutionStruct: import("@metamask/superstruct").Struct<{ + protocol: string; + resolvedDomain: string; + }, { +- protocol: import("superstruct").Struct; +- resolvedDomain: import("superstruct").Struct; ++ protocol: import("@metamask/superstruct").Struct; ++ resolvedDomain: import("@metamask/superstruct").Struct; + }>; +-export declare const DomainResolutionStruct: import("superstruct").Struct<{ ++export declare const DomainResolutionStruct: import("@metamask/superstruct").Struct<{ + protocol: string; + resolvedAddress: string; + domainName: string; + }, { +- protocol: import("superstruct").Struct; +- resolvedAddress: import("superstruct").Struct; +- domainName: import("superstruct").Struct; ++ protocol: import("@metamask/superstruct").Struct; ++ resolvedAddress: import("@metamask/superstruct").Struct; ++ domainName: import("@metamask/superstruct").Struct; + }>; +-export declare const AddressResolutionResponseStruct: import("superstruct").Struct<{ ++export declare const AddressResolutionResponseStruct: import("@metamask/superstruct").Struct<{ + resolvedDomains: { + protocol: string; + resolvedDomain: string; + }[]; + }, { +- resolvedDomains: import("superstruct").Struct<{ ++ resolvedDomains: import("@metamask/superstruct").Struct<{ + protocol: string; + resolvedDomain: string; +- }[], import("superstruct").Struct<{ ++ }[], import("@metamask/superstruct").Struct<{ + protocol: string; + resolvedDomain: string; + }, { +- protocol: import("superstruct").Struct; +- resolvedDomain: import("superstruct").Struct; ++ protocol: import("@metamask/superstruct").Struct; ++ resolvedDomain: import("@metamask/superstruct").Struct; + }>>; + }>; +-export declare const DomainResolutionResponseStruct: import("superstruct").Struct<{ ++export declare const DomainResolutionResponseStruct: import("@metamask/superstruct").Struct<{ + resolvedAddresses: { + protocol: string; + resolvedAddress: string; + domainName: string; + }[]; + }, { +- resolvedAddresses: import("superstruct").Struct<{ ++ resolvedAddresses: import("@metamask/superstruct").Struct<{ + protocol: string; + resolvedAddress: string; + domainName: string; +- }[], import("superstruct").Struct<{ ++ }[], import("@metamask/superstruct").Struct<{ + protocol: string; + resolvedAddress: string; + domainName: string; + }, { +- protocol: import("superstruct").Struct; +- resolvedAddress: import("superstruct").Struct; +- domainName: import("superstruct").Struct; ++ protocol: import("@metamask/superstruct").Struct; ++ resolvedAddress: import("@metamask/superstruct").Struct; ++ domainName: import("@metamask/superstruct").Struct; + }>>; + }>; +-export declare const OnNameLookupResponseStruct: import("superstruct").Struct<{ ++export declare const OnNameLookupResponseStruct: import("@metamask/superstruct").Struct<{ + resolvedDomains: { + protocol: string; + resolvedDomain: string; +diff --git a/dist/types/json-rpc.d.ts b/dist/types/json-rpc.d.ts +index 38718479d623d46c3d8642c4657cab146deb9fca..b55af402712933d212257936c8d2bbafe230feb0 100644 +--- a/dist/types/json-rpc.d.ts ++++ b/dist/types/json-rpc.d.ts +@@ -1,14 +1,14 @@ + import { SubjectType } from '@metamask/permission-controller'; + import type { AssertionErrorConstructor, Json, JsonRpcSuccess } from '@metamask/utils'; +-import type { Infer } from 'superstruct'; +-export declare const RpcOriginsStruct: import("superstruct").Struct<{ ++import type { Infer } from '@metamask/superstruct'; ++export declare const RpcOriginsStruct: import("@metamask/superstruct").Struct<{ + snaps?: boolean | undefined; + dapps?: boolean | undefined; + allowedOrigins?: string[] | undefined; + }, { +- dapps: import("superstruct").Struct; +- snaps: import("superstruct").Struct; +- allowedOrigins: import("superstruct").Struct>; ++ dapps: import("@metamask/superstruct").Struct; ++ snaps: import("@metamask/superstruct").Struct; ++ allowedOrigins: import("@metamask/superstruct").Struct>; + }>; + export declare type RpcOrigins = Infer; + /** +@@ -20,10 +20,10 @@ export declare type RpcOrigins = Infer; + * @throws If the value is not a valid {@link RpcOrigins} object. + */ + export declare function assertIsRpcOrigins(value: unknown, ErrorWrapper?: AssertionErrorConstructor): asserts value is RpcOrigins; +-export declare const KeyringOriginsStruct: import("superstruct").Struct<{ ++export declare const KeyringOriginsStruct: import("@metamask/superstruct").Struct<{ + allowedOrigins?: string[] | undefined; + }, { +- allowedOrigins: import("superstruct").Struct>; ++ allowedOrigins: import("@metamask/superstruct").Struct>; + }>; + export declare type KeyringOrigins = Infer; + /** +diff --git a/dist/types/localization.d.ts b/dist/types/localization.d.ts +index c7912195703b45df5901b048022d9ba4bdb6602e..629c378bfb330ce3ae2a9161e871eb30dc55a653 100644 +--- a/dist/types/localization.d.ts ++++ b/dist/types/localization.d.ts +@@ -1,16 +1,16 @@ +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import type { SnapManifest } from './manifest'; + import type { VirtualFile } from './virtual-file'; + export declare const LOCALIZABLE_FIELDS: readonly ["description", "proposedName"]; +-export declare const LocalizationFileStruct: import("superstruct").Struct<{ ++export declare const LocalizationFileStruct: import("@metamask/superstruct").Struct<{ + locale: string; + messages: Record; + }, { +- locale: import("superstruct").Struct; +- messages: import("superstruct").Struct; ++ messages: import("@metamask/superstruct").Struct, null>; +diff --git a/dist/types/manifest/validation.d.ts b/dist/types/manifest/validation.d.ts +index b76e0771aaf0c63be437bb65c3f9df6ea88c3c90..aed799be05f1dc2cb3a55ef2118b5dbdd80a881b 100644 +--- a/dist/types/manifest/validation.d.ts ++++ b/dist/types/manifest/validation.d.ts +@@ -1,6 +1,6 @@ + import type { SupportedCurve } from '@metamask/key-tree'; + import type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk'; +-import type { Describe, Infer, Struct } from 'superstruct'; ++import type { Describe, Infer, Struct } from '@metamask/superstruct'; + import { type InferMatching } from '../structs'; + export declare const FORBIDDEN_COIN_TYPES: number[]; + export declare const Bip32PathStruct: Struct>; +diff --git a/dist/types/namespace.d.ts b/dist/types/namespace.d.ts +index acff27ac189ddfcd7d2b1da3351e874b8514545f..028eee911e7614e9e25d8a283d408cba1721576f 100644 +--- a/dist/types/namespace.d.ts ++++ b/dist/types/namespace.d.ts +@@ -1,5 +1,5 @@ + import type { AccountId, ChainId } from '@metamask/snaps-sdk'; +-import type { Infer } from 'superstruct'; ++import type { Infer } from '@metamask/superstruct'; + import type { InferMatching } from './structs'; + export declare const CHAIN_ID_REGEX: RegExp; + export declare const ACCOUNT_ID_REGEX: RegExp; +@@ -34,29 +34,29 @@ export declare function parseAccountId(accountId: AccountId): { + * A helper struct for a string with a minimum length of 1 and a maximum length + * of 40. + */ +-export declare const LimitedString: import("superstruct").Struct; +-export declare const ChainIdStringStruct: import("superstruct").Struct<`${string}:${string}`, null>; ++export declare const LimitedString: import("@metamask/superstruct").Struct; ++export declare const ChainIdStringStruct: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; + /** + * A CAIP-2 chain ID, i.e., a human-readable namespace and reference. + */ +-export declare const ChainIdStruct: import("superstruct").Struct<`${string}:${string}`, null>; ++export declare const ChainIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; + export declare type Caip2ChainId = InferMatching; +-export declare const AccountIdStruct: import("superstruct").Struct; +-export declare const AccountIdArrayStruct: import("superstruct").Struct>; +-export declare const AccountAddressStruct: import("superstruct").Struct; ++export declare const AccountIdStruct: import("@metamask/superstruct").Struct; ++export declare const AccountIdArrayStruct: import("@metamask/superstruct").Struct>; ++export declare const AccountAddressStruct: import("@metamask/superstruct").Struct; + export declare type AccountAddress = Infer; + /** + * A chain descriptor. + */ +-export declare const ChainStruct: import("superstruct").Struct<{ ++export declare const ChainStruct: import("@metamask/superstruct").Struct<{ + name: string; + id: `${string}:${string}`; + }, { +- id: import("superstruct").Struct<`${string}:${string}`, null>; +- name: import("superstruct").Struct; ++ id: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; ++ name: import("@metamask/superstruct").Struct; + }>; + export declare type Chain = Infer; +-export declare const NamespaceStruct: import("superstruct").Struct<{ ++export declare const NamespaceStruct: import("@metamask/superstruct").Struct<{ + chains: { + name: string; + id: `${string}:${string}`; +@@ -67,30 +67,30 @@ export declare const NamespaceStruct: import("superstruct").Struct<{ + /** + * A list of supported chains in the namespace. + */ +- chains: import("superstruct").Struct<{ ++ chains: import("@metamask/superstruct").Struct<{ + name: string; + id: `${string}:${string}`; +- }[], import("superstruct").Struct<{ ++ }[], import("@metamask/superstruct").Struct<{ + name: string; + id: `${string}:${string}`; + }, { +- id: import("superstruct").Struct<`${string}:${string}`, null>; +- name: import("superstruct").Struct; ++ id: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; ++ name: import("@metamask/superstruct").Struct; + }>>; + /** + * A list of supported RPC methods on the namespace, that a DApp can call. + */ +- methods: import("superstruct").Struct>; ++ methods: import("@metamask/superstruct").Struct>; + /** + * A list of supported RPC events on the namespace, that a DApp can listen to. + */ +- events: import("superstruct").Struct>; ++ events: import("@metamask/superstruct").Struct>; + }>; + export declare type Namespace = Infer; + /** + * A CAIP-2 namespace, i.e., the first part of a chain ID. + */ +-export declare const NamespaceIdStruct: import("superstruct").Struct; ++export declare const NamespaceIdStruct: import("@metamask/superstruct").Struct; + export declare type NamespaceId = Infer; + /** + * Check if the given value is a CAIP-2 namespace ID. +diff --git a/dist/types/snaps.d.ts b/dist/types/snaps.d.ts +index 3a71172cf0237fdec276a638432f5ecb1ce5fa31..1952369cfbacf55ed2f34589db63789bd9f29cce 100644 +--- a/dist/types/snaps.d.ts ++++ b/dist/types/snaps.d.ts +@@ -1,7 +1,7 @@ + import type { SubjectPermissions, PermissionConstraint } from '@metamask/permission-controller'; + import type { BlockReason } from '@metamask/snaps-registry'; + import type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk'; +-import type { Struct } from 'superstruct'; ++import type { Struct } from '@metamask/superstruct'; + import type { LocalizationFile } from './localization'; + import type { InitialConnections, SnapManifest, SnapPermissions } from './manifest/validation'; + import type { FetchedSnapFiles, SnapsPermissionRequest } from './types'; +diff --git a/dist/types/structs.d.ts b/dist/types/structs.d.ts +index 5b422c937aa9255ddb1f6c4318c397ac9c5b502d..af17efed045764133a569d5c119e2bfb4eb05bbe 100644 +--- a/dist/types/structs.d.ts ++++ b/dist/types/structs.d.ts +@@ -1,6 +1,6 @@ +-import type { Failure } from 'superstruct'; +-import { Struct, StructError } from 'superstruct'; +-import type { AnyStruct, Assign, ObjectSchema, ObjectType } from 'superstruct/dist/utils'; ++import type { Failure } from '@metamask/superstruct'; ++import { Struct, StructError } from '@metamask/superstruct'; ++import type { AnyStruct, Assign, ObjectSchema, ObjectType } from '@metamask/superstruct'; + /** + * Infer a struct type, only if it matches the specified type. This is useful + * for defining types and structs that are related to each other in separate +diff --git a/dist/types/types.d.ts b/dist/types/types.d.ts +index 352b24b26e23625aa1590b282ce0968c7b8ee4c4..cb077cc2b076462353efaafc0fe27523a45fe994 100644 +--- a/dist/types/types.d.ts ++++ b/dist/types/types.d.ts +@@ -1,5 +1,5 @@ + import type { Json } from '@metamask/utils'; +-import type { Infer, Struct } from 'superstruct'; ++import type { Infer, Struct } from '@metamask/superstruct'; + import type { SnapCaveatType } from './caveats'; + import type { SnapFunctionExports, SnapRpcHookArgs } from './handlers'; + import type { LocalizationFile } from './localization'; +diff --git a/package.json b/package.json +index 0c83f7a3ab9a033d1aa188629ba722da9a224278..32a782b54a76d9237892bbadbc71da2910fda36c 100644 +--- a/package.json ++++ b/package.json +@@ -49,6 +49,9 @@ + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" + }, ++ "resolutions": { ++ "@metamask/superstruct": "3.1.0" ++ }, + "dependencies": { + "@babel/core": "^7.23.2", + "@babel/types": "^7.23.0", +@@ -59,7 +62,8 @@ + "@metamask/slip44": "^3.1.0", + "@metamask/snaps-registry": "^3.1.0", + "@metamask/snaps-sdk": "^6.0.0", +- "@metamask/utils": "^8.3.0", ++ "@metamask/superstruct": "^3.1.0", ++ "@metamask/utils": "^8.5.0", + "@noble/hashes": "^1.3.1", + "@scure/base": "^1.1.1", + "chalk": "^4.1.2", +@@ -71,7 +75,6 @@ + "rfdc": "^1.3.0", + "semver": "^7.5.4", + "ses": "^1.1.0", +- "superstruct": "^1.0.3", + "validate-npm-package-name": "^5.0.0" + }, + "devDependencies": { diff --git a/package.json b/package.json index f1ca463070..baa9d4b931 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,12 @@ "resolutions": { "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", - "@metamask/snaps-sdk": "github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk", + "@metamask/snaps-sdk@npm:^4.2.0": "patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch", + "@metamask/snaps-sdk@npm:^4.4.2": "patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch", + "@metamask/snaps-sdk@npm:^6.0.0": "patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch", + "@metamask/snaps-utils@npm:^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", + "@metamask/snaps-utils@npm:^7.5.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", + "@metamask/snaps-utils@npm:^7.7.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", "@metamask/superstruct": "3.1.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 6680a79504..3d71da32b1 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -46,8 +46,8 @@ "@metamask/eth-snap-keyring": "^4.3.1", "@metamask/keyring-api": "^8.0.0", "@metamask/keyring-controller": "^17.1.0", - "@metamask/snaps-sdk": "^4.4.1", - "@metamask/snaps-utils": "^7.4.1", + "@metamask/snaps-sdk": "^6.0.0", + "@metamask/snaps-utils": "^7.7.0", "@metamask/utils": "^8.5.0", "deepmerge": "^4.2.2", "ethereum-cryptography": "^2.1.2", diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 7f3bfd8ddb..3fab0083ca 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -45,8 +45,8 @@ "@metamask/chain-api": "^0.0.1", "@metamask/keyring-api": "^8.0.0", "@metamask/snaps-controllers": "^8.1.1", - "@metamask/snaps-sdk": "^4.4.1", - "@metamask/snaps-utils": "^7.4.1", + "@metamask/snaps-sdk": "^6.0.0", + "@metamask/snaps-utils": "^7.7.0", "@metamask/utils": "^8.5.0", "uuid": "^8.3.2" }, diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 3e7c04e1ac..a774f671ab 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -43,8 +43,8 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/snaps-controllers": "^8.1.1", - "@metamask/snaps-sdk": "^4.4.1", - "@metamask/snaps-utils": "^7.4.1", + "@metamask/snaps-sdk": "^6.0.0", + "@metamask/snaps-utils": "^7.7.0", "@noble/ciphers": "^0.5.2", "@noble/hashes": "^1.4.0", "ethers": "^6.12.0", diff --git a/yarn.lock b/yarn.lock index 5457315deb..0a6b5ea849 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2204,8 +2204,8 @@ __metadata: "@metamask/keyring-api": "npm:^8.0.0" "@metamask/keyring-controller": "npm:^17.1.0" "@metamask/snaps-controllers": "npm:^8.1.1" - "@metamask/snaps-sdk": "npm:^4.4.1" - "@metamask/snaps-utils": "npm:^7.4.1" + "@metamask/snaps-sdk": "npm:^6.0.0" + "@metamask/snaps-utils": "npm:^7.7.0" "@metamask/utils": "npm:^8.5.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" @@ -2463,8 +2463,8 @@ __metadata: "@metamask/chain-api": "npm:^0.0.1" "@metamask/keyring-api": "npm:^8.0.0" "@metamask/snaps-controllers": "npm:^8.1.1" - "@metamask/snaps-sdk": "npm:^4.4.1" - "@metamask/snaps-utils": "npm:^7.4.1" + "@metamask/snaps-sdk": "npm:^6.0.0" + "@metamask/snaps-utils": "npm:^7.7.0" "@metamask/utils": "npm:^8.5.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" @@ -3475,8 +3475,8 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" "@metamask/snaps-controllers": "npm:^8.1.1" - "@metamask/snaps-sdk": "npm:^4.4.1" - "@metamask/snaps-utils": "npm:^7.4.1" + "@metamask/snaps-sdk": "npm:^6.0.0" + "@metamask/snaps-utils": "npm:^7.7.0" "@noble/ciphers": "npm:^0.5.2" "@noble/hashes": "npm:^1.4.0" "@types/jest": "npm:^27.4.1" @@ -3497,7 +3497,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/providers@npm:^17.1.0": +"@metamask/providers@npm:^17.0.0, @metamask/providers@npm:^17.1.0": version: 17.1.0 resolution: "@metamask/providers@npm:17.1.0" dependencies: @@ -3721,14 +3721,33 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@github:MetaMask/snaps#branch=replace-superstruct-with-fork#workspace=@metamask/snaps-sdk": - version: 54.0.0 - resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#branch=replace-superstruct-with-fork%23workspace%3D%40metamask%2Fsnaps-sdk&commit=ad0eae47f9c5d02e61abdc170cc7ee7e94e40c72" - checksum: 10/a3e114f3c6a524e100f89bc69a31d1854a80589442fce1ae06b488b3170a485b41e3ba035f52a9382142cdc0bd50b0ae701977506584c9d1fd2f0841b894406f +"@metamask/snaps-sdk@npm:6.0.0": + version: 6.0.0 + resolution: "@metamask/snaps-sdk@npm:6.0.0" + dependencies: + "@metamask/key-tree": "npm:^9.1.1" + "@metamask/providers": "npm:^17.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/utils": "npm:^8.3.0" + superstruct: "npm:^1.0.3" + checksum: 10/91774ea791423a3cfef4ddbe30fc0351d9bfb9bad071ebce6a74be85cdd9b864b2666785cb6f0e8257a9778bc630f2de71544258d0367a93917ffe3d72ef90a5 languageName: node linkType: hard -"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.4.1, @metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0": +"@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch": + version: 6.0.0 + resolution: "@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch::version=6.0.0&hash=8f563d" + dependencies: + "@metamask/key-tree": "npm:^9.1.1" + "@metamask/providers": "npm:^17.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/utils": "npm:^8.3.0" + superstruct: "npm:^1.0.3" + checksum: 10/25a89c5b0966482e894768bf6e5acf7dd23aff8e6d72e940528059cd06b71e15bc2aad1e0edd1362f4083643e0eac162ded7ea6b75df10e68998f68fa641566a + languageName: node + linkType: hard + +"@metamask/snaps-utils@npm:7.7.0": version: 7.7.0 resolution: "@metamask/snaps-utils@npm:7.7.0" dependencies: @@ -3759,6 +3778,37 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch": + version: 7.7.0 + resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch::version=7.7.0&hash=038c48" + dependencies: + "@babel/core": "npm:^7.23.2" + "@babel/types": "npm:^7.23.0" + "@metamask/base-controller": "npm:^6.0.0" + "@metamask/key-tree": "npm:^9.1.1" + "@metamask/permission-controller": "npm:^10.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/slip44": "npm:^3.1.0" + "@metamask/snaps-registry": "npm:^3.1.0" + "@metamask/snaps-sdk": "npm:^6.0.0" + "@metamask/utils": "npm:^8.3.0" + "@noble/hashes": "npm:^1.3.1" + "@scure/base": "npm:^1.1.1" + chalk: "npm:^4.1.2" + cron-parser: "npm:^4.5.0" + fast-deep-equal: "npm:^3.1.3" + fast-json-stable-stringify: "npm:^2.1.0" + fast-xml-parser: "npm:^4.3.4" + marked: "npm:^12.0.1" + rfdc: "npm:^1.3.0" + semver: "npm:^7.5.4" + ses: "npm:^1.1.0" + superstruct: "npm:^1.0.3" + validate-npm-package-name: "npm:^5.0.0" + checksum: 10/aeb81017d820a598710a8f3eb797770ce981de766b72cbda6e1435de3665dfeca71ef391411e40300419886363b822f0ef08750f646370f8f4e3449721272447 + languageName: node + linkType: hard + "@metamask/superstruct@npm:3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" From a67c547805fe67045deff8dfbd2f8784f20b0db0 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 16:27:02 -0400 Subject: [PATCH 27/47] Fix subpath imports, which are no longer supported unless specified in the upstream package's package.json exports field --- .../src/AccountTrackerController.test.ts | 16 ++++++++-------- .../src/TokenRatesController.test.ts | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/assets-controllers/src/AccountTrackerController.test.ts b/packages/assets-controllers/src/AccountTrackerController.test.ts index 1cc04814ae..b68b5e0eb2 100644 --- a/packages/assets-controllers/src/AccountTrackerController.test.ts +++ b/packages/assets-controllers/src/AccountTrackerController.test.ts @@ -1,8 +1,4 @@ import { ControllerMessenger } from '@metamask/base-controller'; -import type { - ExtractAvailableAction, - ExtractAvailableEvent, -} from '@metamask/base-controller/tests/helpers'; import { query, toChecksumHexAddress } from '@metamask/controller-utils'; import type { InternalAccount } from '@metamask/keyring-api'; import { @@ -10,15 +6,19 @@ import { type NetworkClientConfiguration, defaultState as defaultnetworkControllerState, } from '@metamask/network-controller'; -import { - buildCustomNetworkClientConfiguration, - buildMockGetNetworkClientById, -} from '@metamask/network-controller/tests/helpers'; import { getDefaultPreferencesState } from '@metamask/preferences-controller'; import * as sinon from 'sinon'; import { advanceTime } from '../../../tests/helpers'; import { createMockInternalAccount } from '../../accounts-controller/src/tests/mocks'; +import type { + ExtractAvailableAction, + ExtractAvailableEvent, +} from '../../base-controller/tests/helpers'; +import { + buildCustomNetworkClientConfiguration, + buildMockGetNetworkClientById, +} from '../../network-controller/tests/helpers'; import type { AccountTrackerControllerMessenger, AllowedActions, diff --git a/packages/assets-controllers/src/TokenRatesController.test.ts b/packages/assets-controllers/src/TokenRatesController.test.ts index 4ba07c9cb5..f30a09d042 100644 --- a/packages/assets-controllers/src/TokenRatesController.test.ts +++ b/packages/assets-controllers/src/TokenRatesController.test.ts @@ -1,4 +1,3 @@ -import { createMockInternalAccount } from '@metamask/accounts-controller/src/tests/mocks'; import type { AddApprovalRequest } from '@metamask/approval-controller'; import { ControllerMessenger } from '@metamask/base-controller'; import { @@ -10,11 +9,11 @@ import { } from '@metamask/controller-utils'; import type { InternalAccount } from '@metamask/keyring-api'; import type { + NetworkClientConfiguration, NetworkClientId, NetworkState, } from '@metamask/network-controller'; import { defaultState as defaultNetworkState } from '@metamask/network-controller'; -import type { NetworkClientConfiguration } from '@metamask/network-controller/src/types'; import type { Hex } from '@metamask/utils'; import { add0x } from '@metamask/utils'; import assert from 'assert'; @@ -22,6 +21,7 @@ import nock from 'nock'; import { useFakeTimers } from 'sinon'; import { advanceTime } from '../../../tests/helpers'; +import { createMockInternalAccount } from '../../accounts-controller/src/tests/mocks'; import { buildCustomNetworkClientConfiguration, buildMockGetNetworkClientById, From 864ec65d31eb9d1a7ac1bb376ccb9c5f57762e7d Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 28 Jun 2024 15:11:22 -0400 Subject: [PATCH 28/47] Bump `@metamask/utils` from `^8.5.0` to `^9.0.0` --- ...ask-snaps-utils-npm-7.7.0-2cc1f044af.patch | 2 +- package.json | 2 +- packages/accounts-controller/package.json | 2 +- packages/address-book-controller/package.json | 2 +- packages/approval-controller/package.json | 2 +- packages/assets-controllers/package.json | 2 +- packages/base-controller/package.json | 2 +- packages/build-utils/package.json | 2 +- packages/chain-controller/package.json | 2 +- packages/controller-utils/package.json | 2 +- packages/ens-controller/package.json | 2 +- packages/eth-json-rpc-provider/package.json | 2 +- packages/gas-fee-controller/package.json | 2 +- packages/json-rpc-engine/package.json | 2 +- .../json-rpc-middleware-stream/package.json | 2 +- packages/keyring-controller/package.json | 2 +- packages/message-manager/package.json | 2 +- packages/name-controller/package.json | 2 +- packages/network-controller/package.json | 2 +- packages/notification-controller/package.json | 2 +- packages/permission-controller/package.json | 2 +- .../permission-log-controller/package.json | 2 +- packages/polling-controller/package.json | 2 +- .../queued-request-controller/package.json | 2 +- packages/rate-limit-controller/package.json | 2 +- .../selected-network-controller/package.json | 2 +- packages/signature-controller/package.json | 2 +- packages/transaction-controller/package.json | 2 +- .../user-operation-controller/package.json | 2 +- yarn.lock | 77 +++++++++++-------- 30 files changed, 76 insertions(+), 59 deletions(-) diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch index b159e34010..43df93b32a 100644 --- a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch +++ b/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch @@ -688,7 +688,7 @@ index 0c83f7a3ab9a033d1aa188629ba722da9a224278..32a782b54a76d9237892bbadbc71da29 "@metamask/snaps-sdk": "^6.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/superstruct": "^3.1.0", -+ "@metamask/utils": "^8.5.0", ++ "@metamask/utils": "^9.0.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.1", "chalk": "^4.1.2", diff --git a/package.json b/package.json index baa9d4b931..65852de000 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@metamask/eth-block-tracker": "^9.0.3", "@metamask/eth-json-rpc-provider": "^4.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/jest": "^27.4.1", "@types/node": "^16.18.54", "@typescript-eslint/eslint-plugin": "^5.62.0", diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 3d71da32b1..baf45c3b17 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -48,7 +48,7 @@ "@metamask/keyring-controller": "^17.1.0", "@metamask/snaps-sdk": "^6.0.0", "@metamask/snaps-utils": "^7.7.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "deepmerge": "^4.2.2", "ethereum-cryptography": "^2.1.2", "immer": "^9.0.6", diff --git a/packages/address-book-controller/package.json b/packages/address-book-controller/package.json index 1a8dfd9380..7beb1f9f10 100644 --- a/packages/address-book-controller/package.json +++ b/packages/address-book-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/approval-controller/package.json b/packages/approval-controller/package.json index 2172147d30..9d41d04825 100644 --- a/packages/approval-controller/package.json +++ b/packages/approval-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "nanoid": "^3.1.31" }, "devDependencies": { diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index 99e24b14d0..6db43e5d12 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -59,7 +59,7 @@ "@metamask/polling-controller": "^8.0.0", "@metamask/preferences-controller": "^13.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", "async-mutex": "^0.5.0", diff --git a/packages/base-controller/package.json b/packages/base-controller/package.json index ae15ca7238..65b00156c2 100644 --- a/packages/base-controller/package.json +++ b/packages/base-controller/package.json @@ -40,7 +40,7 @@ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "immer": "^9.0.6" }, "devDependencies": { diff --git a/packages/build-utils/package.json b/packages/build-utils/package.json index ba5a540d43..cac41e13f1 100644 --- a/packages/build-utils/package.json +++ b/packages/build-utils/package.json @@ -41,7 +41,7 @@ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/eslint": "^8.44.7" }, "devDependencies": { diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 3fab0083ca..9ec43d7673 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -47,7 +47,7 @@ "@metamask/snaps-controllers": "^8.1.1", "@metamask/snaps-sdk": "^6.0.0", "@metamask/snaps-utils": "^7.7.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/packages/controller-utils/package.json b/packages/controller-utils/package.json index 45dfdd7fd9..64e1504033 100644 --- a/packages/controller-utils/package.json +++ b/packages/controller-utils/package.json @@ -44,7 +44,7 @@ "@ethereumjs/util": "^8.1.0", "@metamask/eth-query": "^4.0.0", "@metamask/ethjs-unit": "^0.3.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@spruceid/siwe-parser": "2.1.0", "@types/bn.js": "^5.1.5", "bn.js": "^5.2.1", diff --git a/packages/ens-controller/package.json b/packages/ens-controller/package.json index 1424f1d3c2..6c81a42c19 100644 --- a/packages/ens-controller/package.json +++ b/packages/ens-controller/package.json @@ -44,7 +44,7 @@ "@ethersproject/providers": "^5.7.0", "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "punycode": "^2.1.1" }, "devDependencies": { diff --git a/packages/eth-json-rpc-provider/package.json b/packages/eth-json-rpc-provider/package.json index 51e8def1ee..27722634e1 100644 --- a/packages/eth-json-rpc-provider/package.json +++ b/packages/eth-json-rpc-provider/package.json @@ -48,7 +48,7 @@ "dependencies": { "@metamask/json-rpc-engine": "^9.0.0", "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/gas-fee-controller/package.json b/packages/gas-fee-controller/package.json index ee49381a1e..d9aaefec40 100644 --- a/packages/gas-fee-controller/package.json +++ b/packages/gas-fee-controller/package.json @@ -47,7 +47,7 @@ "@metamask/ethjs-unit": "^0.3.0", "@metamask/network-controller": "^19.0.0", "@metamask/polling-controller": "^8.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", "bn.js": "^5.2.1", diff --git a/packages/json-rpc-engine/package.json b/packages/json-rpc-engine/package.json index 858188cfc1..601affe5a5 100644 --- a/packages/json-rpc-engine/package.json +++ b/packages/json-rpc-engine/package.json @@ -52,7 +52,7 @@ "dependencies": { "@metamask/rpc-errors": "^6.2.1", "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/json-rpc-middleware-stream/package.json b/packages/json-rpc-middleware-stream/package.json index d30e464aff..70193711e3 100644 --- a/packages/json-rpc-middleware-stream/package.json +++ b/packages/json-rpc-middleware-stream/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/json-rpc-engine": "^9.0.0", "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "readable-stream": "^3.6.2" }, "devDependencies": { diff --git a/packages/keyring-controller/package.json b/packages/keyring-controller/package.json index 68b36dbe24..5995dc19d4 100644 --- a/packages/keyring-controller/package.json +++ b/packages/keyring-controller/package.json @@ -50,7 +50,7 @@ "@metamask/eth-simple-keyring": "^6.0.1", "@metamask/keyring-api": "^8.0.0", "@metamask/message-manager": "^10.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0", "ethereumjs-wallet": "^1.0.1", "immer": "^9.0.6" diff --git a/packages/message-manager/package.json b/packages/message-manager/package.json index b6f8c8fc6d..d7c4a5474f 100644 --- a/packages/message-manager/package.json +++ b/packages/message-manager/package.json @@ -44,7 +44,7 @@ "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", "@metamask/eth-sig-util": "^7.0.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/uuid": "^8.3.0", "jsonschema": "^1.2.4", "uuid": "^8.3.2" diff --git a/packages/name-controller/package.json b/packages/name-controller/package.json index 80bfed5751..071323b7dd 100644 --- a/packages/name-controller/package.json +++ b/packages/name-controller/package.json @@ -44,7 +44,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0" }, "devDependencies": { diff --git a/packages/network-controller/package.json b/packages/network-controller/package.json index 31cfe7e79c..877e040124 100644 --- a/packages/network-controller/package.json +++ b/packages/network-controller/package.json @@ -51,7 +51,7 @@ "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/swappable-obj-proxy": "^2.2.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0", "immer": "^9.0.6", "uuid": "^8.3.2" diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json index dd595204a1..ce1c0f696f 100644 --- a/packages/notification-controller/package.json +++ b/packages/notification-controller/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@metamask/base-controller": "^6.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "nanoid": "^3.1.31" }, "devDependencies": { diff --git a/packages/permission-controller/package.json b/packages/permission-controller/package.json index 367ef4f73c..90469b16b8 100644 --- a/packages/permission-controller/package.json +++ b/packages/permission-controller/package.json @@ -45,7 +45,7 @@ "@metamask/controller-utils": "^11.0.0", "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/deep-freeze-strict": "^1.1.0", "deep-freeze-strict": "^1.1.1", "immer": "^9.0.6", diff --git a/packages/permission-log-controller/package.json b/packages/permission-log-controller/package.json index 064be920db..9003492ccd 100644 --- a/packages/permission-log-controller/package.json +++ b/packages/permission-log-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/polling-controller/package.json b/packages/polling-controller/package.json index 11d4ad958d..e3a67c3385 100644 --- a/packages/polling-controller/package.json +++ b/packages/polling-controller/package.json @@ -44,7 +44,7 @@ "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", "@metamask/network-controller": "^19.0.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@types/uuid": "^8.3.0", "fast-json-stable-stringify": "^2.1.0", "uuid": "^8.3.2" diff --git a/packages/queued-request-controller/package.json b/packages/queued-request-controller/package.json index 0bcef58ad7..6c5c35824d 100644 --- a/packages/queued-request-controller/package.json +++ b/packages/queued-request-controller/package.json @@ -46,7 +46,7 @@ "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/swappable-obj-proxy": "^2.2.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/rate-limit-controller/package.json b/packages/rate-limit-controller/package.json index 16b60e6d98..2adb1c90cb 100644 --- a/packages/rate-limit-controller/package.json +++ b/packages/rate-limit-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/selected-network-controller/package.json b/packages/selected-network-controller/package.json index 576900a8c5..7a5f8d7363 100644 --- a/packages/selected-network-controller/package.json +++ b/packages/selected-network-controller/package.json @@ -46,7 +46,7 @@ "@metamask/network-controller": "^19.0.0", "@metamask/permission-controller": "^10.0.0", "@metamask/swappable-obj-proxy": "^2.2.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/signature-controller/package.json b/packages/signature-controller/package.json index d9ede33272..ced4c6fd90 100644 --- a/packages/signature-controller/package.json +++ b/packages/signature-controller/package.json @@ -48,7 +48,7 @@ "@metamask/logging-controller": "^5.0.0", "@metamask/message-manager": "^10.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "lodash": "^4.17.21" }, "devDependencies": { diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index 3396f126b3..9f18c3b4a5 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -57,7 +57,7 @@ "@metamask/network-controller": "^19.0.0", "@metamask/nonce-tracker": "^5.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0", "bn.js": "^5.2.1", "eth-method-registry": "^4.0.0", diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index 23df0d4f83..f1093749fb 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -53,7 +53,7 @@ "@metamask/rpc-errors": "^6.2.1", "@metamask/superstruct": "^3.1.0", "@metamask/transaction-controller": "^33.0.1", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "bn.js": "^5.2.1", "immer": "^9.0.6", "lodash": "^4.17.21", diff --git a/yarn.lock b/yarn.lock index 0a6b5ea849..fe130ce2b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2206,7 +2206,7 @@ __metadata: "@metamask/snaps-controllers": "npm:^8.1.1" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/snaps-utils": "npm:^7.7.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" deepmerge: "npm:^4.2.2" @@ -2242,7 +2242,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" "@metamask/controller-utils": "npm:^11.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -2288,7 +2288,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -2326,7 +2326,7 @@ __metadata: "@metamask/polling-controller": "npm:^8.0.0" "@metamask/preferences-controller": "npm:^13.0.0" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/bn.js": "npm:^5.1.5" "@types/jest": "npm:^27.4.1" "@types/lodash": "npm:^4.14.191" @@ -2403,7 +2403,7 @@ __metadata: resolution: "@metamask/base-controller@workspace:packages/base-controller" dependencies: "@metamask/auto-changelog": "npm:^3.4.4" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/sinon": "npm:^9.0.10" deepmerge: "npm:^4.2.2" @@ -2431,7 +2431,7 @@ __metadata: resolution: "@metamask/build-utils@workspace:packages/build-utils" dependencies: "@metamask/auto-changelog": "npm:^3.4.4" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/eslint": "npm:^8.44.7" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" @@ -2465,7 +2465,7 @@ __metadata: "@metamask/snaps-controllers": "npm:^8.1.1" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/snaps-utils": "npm:^7.7.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" deepmerge: "npm:^4.2.2" @@ -2529,7 +2529,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/eth-query": "npm:^4.0.0" "@metamask/ethjs-unit": "npm:^0.3.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@spruceid/siwe-parser": "npm:2.1.0" "@types/bn.js": "npm:^5.1.5" "@types/jest": "npm:^27.4.1" @@ -2562,7 +2562,7 @@ __metadata: "@metamask/eth-block-tracker": "npm:^9.0.3" "@metamask/eth-json-rpc-provider": "npm:^4.0.0" "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/node": "npm:^16.18.54" "@typescript-eslint/eslint-plugin": "npm:^5.62.0" @@ -2626,7 +2626,7 @@ __metadata: "@metamask/base-controller": "npm:^6.0.0" "@metamask/controller-utils": "npm:^11.0.0" "@metamask/network-controller": "npm:^19.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -2775,7 +2775,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/json-rpc-engine": "npm:^9.0.0" "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -2951,7 +2951,7 @@ __metadata: "@metamask/ethjs-unit": "npm:^0.3.0" "@metamask/network-controller": "npm:^19.0.0" "@metamask/polling-controller": "npm:^8.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/bn.js": "npm:^5.1.5" "@types/jest": "npm:^27.4.1" "@types/jest-when": "npm:^2.7.3" @@ -3002,7 +3002,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/rpc-errors": "npm:^6.2.1" "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -3032,7 +3032,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/json-rpc-engine": "npm:^9.0.0" "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" deepmerge: "npm:^4.2.2" @@ -3097,7 +3097,7 @@ __metadata: "@metamask/keyring-api": "npm:^8.0.0" "@metamask/message-manager": "npm:^10.0.0" "@metamask/scure-bip39": "npm:^2.1.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" async-mutex: "npm:^0.5.0" deepmerge: "npm:^4.2.2" @@ -3140,7 +3140,7 @@ __metadata: "@metamask/base-controller": "npm:^6.0.0" "@metamask/controller-utils": "npm:^11.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/uuid": "npm:^8.3.0" deepmerge: "npm:^4.2.2" @@ -3168,7 +3168,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" "@metamask/controller-utils": "npm:^11.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" async-mutex: "npm:^0.5.0" deepmerge: "npm:^4.2.2" @@ -3196,7 +3196,7 @@ __metadata: "@metamask/json-rpc-engine": "npm:^9.0.0" "@metamask/rpc-errors": "npm:^6.2.1" "@metamask/swappable-obj-proxy": "npm:^2.2.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/jest-when": "npm:^2.7.3" "@types/lodash": "npm:^4.14.191" @@ -3234,7 +3234,7 @@ __metadata: dependencies: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -3318,7 +3318,7 @@ __metadata: "@metamask/controller-utils": "npm:^11.0.0" "@metamask/json-rpc-engine": "npm:^9.0.0" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/deep-freeze-strict": "npm:^1.1.0" "@types/jest": "npm:^27.4.1" deep-freeze-strict: "npm:^1.1.1" @@ -3361,7 +3361,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/deep-freeze-strict": "npm:^1.1.0" "@types/jest": "npm:^27.4.1" deep-freeze-strict: "npm:^1.1.1" @@ -3419,7 +3419,7 @@ __metadata: "@metamask/base-controller": "npm:^6.0.0" "@metamask/controller-utils": "npm:^11.0.0" "@metamask/network-controller": "npm:^19.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" "@types/uuid": "npm:^8.3.0" deepmerge: "npm:^4.2.2" @@ -3530,7 +3530,7 @@ __metadata: "@metamask/rpc-errors": "npm:^6.2.1" "@metamask/selected-network-controller": "npm:^15.0.2" "@metamask/swappable-obj-proxy": "npm:^2.2.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" immer: "npm:^9.0.6" @@ -3555,7 +3555,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -3603,7 +3603,7 @@ __metadata: "@metamask/network-controller": "npm:^19.0.0" "@metamask/permission-controller": "npm:^10.0.0" "@metamask/swappable-obj-proxy": "npm:^2.2.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" immer: "npm:^9.0.6" @@ -3633,7 +3633,7 @@ __metadata: "@metamask/logging-controller": "npm:^5.0.0" "@metamask/message-manager": "npm:^10.0.0" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" jest: "npm:^27.5.1" @@ -3780,7 +3780,7 @@ __metadata: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch": version: 7.7.0 - resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch::version=7.7.0&hash=038c48" + resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch::version=7.7.0&hash=2f2f4c" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" @@ -3805,7 +3805,7 @@ __metadata: ses: "npm:^1.1.0" superstruct: "npm:^1.0.3" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/aeb81017d820a598710a8f3eb797770ce981de766b72cbda6e1435de3665dfeca71ef391411e40300419886363b822f0ef08750f646370f8f4e3449721272447 + checksum: 10/e72506593957f87678ccbd66c316c933d5b9e01f4ca2b104e8f3e1fa8de384e9570ba4f1ce12692e62e64610625947491db18bcc8aeff89c7cea848cf08c5222 languageName: node linkType: hard @@ -3848,7 +3848,7 @@ __metadata: "@metamask/network-controller": "npm:^19.0.0" "@metamask/nonce-tracker": "npm:^5.0.0" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/bn.js": "npm:^5.1.5" "@types/jest": "npm:^27.4.1" "@types/node": "npm:^16.18.54" @@ -3892,7 +3892,7 @@ __metadata: "@metamask/rpc-errors": "npm:^6.2.1" "@metamask/superstruct": "npm:^3.1.0" "@metamask/transaction-controller": "npm:^33.0.1" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" bn.js: "npm:^5.2.1" deepmerge: "npm:^4.2.2" @@ -3930,6 +3930,23 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^9.0.0": + version: 9.0.0 + resolution: "@metamask/utils@npm:9.0.0" + dependencies: + "@ethereumjs/tx": "npm:^4.2.0" + "@metamask/superstruct": "npm:^3.1.0" + "@noble/hashes": "npm:^1.3.1" + "@scure/base": "npm:^1.1.3" + "@types/debug": "npm:^4.1.7" + debug: "npm:^4.3.4" + pony-cause: "npm:^2.1.10" + semver: "npm:^7.5.4" + uuid: "npm:^9.0.1" + checksum: 10/04a4eaba79e166fc6d23ecdba8b60625235a3a8c81fa615de64b845e74fa099ea7afd031060206c24809cfa161e7bca5aeb0bfd26079c5cbb82cb37f6a55ddb2 + languageName: node + linkType: hard + "@ngraveio/bc-ur@npm:^1.1.5": version: 1.1.13 resolution: "@ngraveio/bc-ur@npm:1.1.13" From 9bbd37d85d97b837d0e4ca528a00bf3cb7f30ef1 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 28 Jun 2024 23:11:56 -0400 Subject: [PATCH 29/47] Force yarn resolution for `@metamask/utils` to `9.0.0` --- package.json | 2 +- yarn.lock | 21 ++------------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 65852de000..d334eaa0dc 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@metamask/snaps-utils@npm:^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", "@metamask/snaps-utils@npm:^7.5.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", "@metamask/snaps-utils@npm:^7.7.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", - "@metamask/superstruct": "3.1.0", + "@metamask/utils": "9.0.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index fe130ce2b6..0feb88d487 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3809,7 +3809,7 @@ __metadata: languageName: node linkType: hard -"@metamask/superstruct@npm:3.1.0": +"@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" checksum: 10/5066fe228d5f11da387606d7f9545de2b473ab5a9e0f1bb8aea2f52d3e2c9d25e427151acde61f4a2de80a07a9871fe9505ad06abca6a61b7c3b54ed5c403b01 @@ -3913,24 +3913,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0, @metamask/utils@npm:^8.5.0": - version: 8.5.0 - resolution: "@metamask/utils@npm:8.5.0" - dependencies: - "@ethereumjs/tx": "npm:^4.2.0" - "@metamask/superstruct": "npm:^3.0.0" - "@noble/hashes": "npm:^1.3.1" - "@scure/base": "npm:^1.1.3" - "@types/debug": "npm:^4.1.7" - debug: "npm:^4.3.4" - pony-cause: "npm:^2.1.10" - semver: "npm:^7.5.4" - uuid: "npm:^9.0.1" - checksum: 10/68a42a55f7dc750b75467fb7c05a496c20dac073a2753e0f4d9642c4d8dcb3f9ddf51a09d30337e11637f1777f3dfe22e15b5159dbafb0fdb7bd8c9236056153 - languageName: node - linkType: hard - -"@metamask/utils@npm:^9.0.0": +"@metamask/utils@npm:9.0.0": version: 9.0.0 resolution: "@metamask/utils@npm:9.0.0" dependencies: From bf5d24016ac6ebb7e5eb7916bd199e6627757174 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 3 Jul 2024 15:00:09 -0400 Subject: [PATCH 30/47] Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` --- packages/approval-controller/package.json | 2 +- packages/assets-controllers/package.json | 2 +- packages/json-rpc-engine/package.json | 2 +- packages/network-controller/package.json | 2 +- packages/permission-controller/package.json | 2 +- .../queued-request-controller/package.json | 2 +- packages/rate-limit-controller/package.json | 2 +- packages/signature-controller/package.json | 2 +- packages/transaction-controller/package.json | 2 +- .../user-operation-controller/package.json | 2 +- yarn.lock | 36 ++++++++++++------- 11 files changed, 33 insertions(+), 23 deletions(-) diff --git a/packages/approval-controller/package.json b/packages/approval-controller/package.json index 9d41d04825..96266c8533 100644 --- a/packages/approval-controller/package.json +++ b/packages/approval-controller/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@metamask/base-controller": "^6.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/utils": "^9.0.0", "nanoid": "^3.1.31" }, diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index 6db43e5d12..3b749de0c6 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -58,7 +58,7 @@ "@metamask/network-controller": "^19.0.0", "@metamask/polling-controller": "^8.0.0", "@metamask/preferences-controller": "^13.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/utils": "^9.0.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", diff --git a/packages/json-rpc-engine/package.json b/packages/json-rpc-engine/package.json index 601affe5a5..62b6fddab0 100644 --- a/packages/json-rpc-engine/package.json +++ b/packages/json-rpc-engine/package.json @@ -50,7 +50,7 @@ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^9.0.0" }, diff --git a/packages/network-controller/package.json b/packages/network-controller/package.json index 877e040124..a943c8b85e 100644 --- a/packages/network-controller/package.json +++ b/packages/network-controller/package.json @@ -49,7 +49,7 @@ "@metamask/eth-json-rpc-provider": "^4.0.0", "@metamask/eth-query": "^4.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/swappable-obj-proxy": "^2.2.0", "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0", diff --git a/packages/permission-controller/package.json b/packages/permission-controller/package.json index 90469b16b8..3e8a09ab1b 100644 --- a/packages/permission-controller/package.json +++ b/packages/permission-controller/package.json @@ -44,7 +44,7 @@ "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/utils": "^9.0.0", "@types/deep-freeze-strict": "^1.1.0", "deep-freeze-strict": "^1.1.1", diff --git a/packages/queued-request-controller/package.json b/packages/queued-request-controller/package.json index 6c5c35824d..4e2a950fa1 100644 --- a/packages/queued-request-controller/package.json +++ b/packages/queued-request-controller/package.json @@ -44,7 +44,7 @@ "@metamask/base-controller": "^6.0.0", "@metamask/controller-utils": "^11.0.0", "@metamask/json-rpc-engine": "^9.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/swappable-obj-proxy": "^2.2.0", "@metamask/utils": "^9.0.0" }, diff --git a/packages/rate-limit-controller/package.json b/packages/rate-limit-controller/package.json index 2adb1c90cb..93bc47967a 100644 --- a/packages/rate-limit-controller/package.json +++ b/packages/rate-limit-controller/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@metamask/base-controller": "^6.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/utils": "^9.0.0" }, "devDependencies": { diff --git a/packages/signature-controller/package.json b/packages/signature-controller/package.json index ced4c6fd90..ad465f6906 100644 --- a/packages/signature-controller/package.json +++ b/packages/signature-controller/package.json @@ -47,7 +47,7 @@ "@metamask/keyring-controller": "^17.1.0", "@metamask/logging-controller": "^5.0.0", "@metamask/message-manager": "^10.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/utils": "^9.0.0", "lodash": "^4.17.21" }, diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index 9f18c3b4a5..dfa0013c7b 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -56,7 +56,7 @@ "@metamask/metamask-eth-abis": "^3.1.1", "@metamask/network-controller": "^19.0.0", "@metamask/nonce-tracker": "^5.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0", "bn.js": "^5.2.1", diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index f1093749fb..afe252789a 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -50,7 +50,7 @@ "@metamask/keyring-controller": "^17.1.0", "@metamask/network-controller": "^19.0.0", "@metamask/polling-controller": "^8.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/superstruct": "^3.1.0", "@metamask/transaction-controller": "^33.0.1", "@metamask/utils": "^9.0.0", diff --git a/yarn.lock b/yarn.lock index 0feb88d487..64a59a79ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2287,7 +2287,7 @@ __metadata: dependencies: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" @@ -2325,7 +2325,7 @@ __metadata: "@metamask/network-controller": "npm:^19.0.0" "@metamask/polling-controller": "npm:^8.0.0" "@metamask/preferences-controller": "npm:^13.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/utils": "npm:^9.0.0" "@types/bn.js": "npm:^5.1.5" "@types/jest": "npm:^27.4.1" @@ -3000,7 +3000,7 @@ __metadata: dependencies: "@lavamoat/allow-scripts": "npm:^3.0.4" "@metamask/auto-changelog": "npm:^3.4.4" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/safe-event-emitter": "npm:^3.0.0" "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" @@ -3063,18 +3063,18 @@ __metadata: "@metamask/keyring-api@github:MetaMask/keyring-api#replace-superstruct-with-fork": version: 8.0.0 - resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=155384dad1f4d394276c4c639ea495d5840f2b2b" + resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=6ec0879a3d7bf467c850e7dd17728aa9119aa68c" dependencies: "@metamask/providers": "npm:^17.1.0" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^9.0.0" "@types/uuid": "npm:^9.0.8" bech32: "npm:^2.0.0" uuid: "npm:^9.0.1" peerDependencies: "@metamask/providers": ">=15 <18" - checksum: 10/76c38ced7a693e823ba38cc5acd163a7377b3dc39eb98af4aed19e97a26bc00b1118b48d6494eef8168b920f2239925452ff4c3857ff99f58bc960854a0ca5fd + checksum: 10/2170cddf5c518699e8e5f3f2f6a6ef532ca06887c8e3cbe393e1a4b0162a92a4f954fc25ea71aaa1bb06df64ff933fba02690a00282c0ec6bebf7352d5e57e08 languageName: node linkType: hard @@ -3194,7 +3194,7 @@ __metadata: "@metamask/eth-json-rpc-provider": "npm:^4.0.0" "@metamask/eth-query": "npm:^4.0.0" "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/swappable-obj-proxy": "npm:^2.2.0" "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" @@ -3317,7 +3317,7 @@ __metadata: "@metamask/base-controller": "npm:^6.0.0" "@metamask/controller-utils": "npm:^11.0.0" "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/utils": "npm:^9.0.0" "@types/deep-freeze-strict": "npm:^1.1.0" "@types/jest": "npm:^27.4.1" @@ -3527,7 +3527,7 @@ __metadata: "@metamask/controller-utils": "npm:^11.0.0" "@metamask/json-rpc-engine": "npm:^9.0.0" "@metamask/network-controller": "npm:^19.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/selected-network-controller": "npm:^15.0.2" "@metamask/swappable-obj-proxy": "npm:^2.2.0" "@metamask/utils": "npm:^9.0.0" @@ -3554,7 +3554,7 @@ __metadata: dependencies: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" @@ -3576,6 +3576,16 @@ __metadata: languageName: node linkType: hard +"@metamask/rpc-errors@npm:^6.3.1": + version: 6.3.1 + resolution: "@metamask/rpc-errors@npm:6.3.1" + dependencies: + "@metamask/utils": "npm:^9.0.0" + fast-safe-stringify: "npm:^2.0.6" + checksum: 10/f968fb490b13b632c2ad4770a144d67cecdff8d539cb8b489c732b08dab7a62fae65d7a2908ce8c5b77260317aa618948a52463f093fa8d9f84aee1c5f6f5daf + languageName: node + linkType: hard + "@metamask/safe-event-emitter@npm:^3.0.0, @metamask/safe-event-emitter@npm:^3.1.1": version: 3.1.1 resolution: "@metamask/safe-event-emitter@npm:3.1.1" @@ -3632,7 +3642,7 @@ __metadata: "@metamask/keyring-controller": "npm:^17.1.0" "@metamask/logging-controller": "npm:^5.0.0" "@metamask/message-manager": "npm:^10.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/utils": "npm:^9.0.0" "@types/jest": "npm:^27.4.1" deepmerge: "npm:^4.2.2" @@ -3847,7 +3857,7 @@ __metadata: "@metamask/metamask-eth-abis": "npm:^3.1.1" "@metamask/network-controller": "npm:^19.0.0" "@metamask/nonce-tracker": "npm:^5.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/utils": "npm:^9.0.0" "@types/bn.js": "npm:^5.1.5" "@types/jest": "npm:^27.4.1" @@ -3889,7 +3899,7 @@ __metadata: "@metamask/keyring-controller": "npm:^17.1.0" "@metamask/network-controller": "npm:^19.0.0" "@metamask/polling-controller": "npm:^8.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/superstruct": "npm:^3.1.0" "@metamask/transaction-controller": "npm:^33.0.1" "@metamask/utils": "npm:^9.0.0" From 2ca426594cb9b1ed2f7165704a9c14e626e56f04 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 3 Jul 2024 15:04:44 -0400 Subject: [PATCH 31/47] Revert "Force yarn resolution for `@metamask/utils` to `9.0.0`" This reverts commit 9bbd37d85d97b837d0e4ca528a00bf3cb7f30ef1. --- package.json | 1 - yarn.lock | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d334eaa0dc..a81d60e450 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "@metamask/snaps-utils@npm:^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", "@metamask/snaps-utils@npm:^7.5.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", "@metamask/snaps-utils@npm:^7.7.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", - "@metamask/utils": "9.0.0", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 64a59a79ff..4a5581d5c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3923,7 +3923,24 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:9.0.0": +"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0, @metamask/utils@npm:^8.5.0": + version: 8.5.0 + resolution: "@metamask/utils@npm:8.5.0" + dependencies: + "@ethereumjs/tx": "npm:^4.2.0" + "@metamask/superstruct": "npm:^3.0.0" + "@noble/hashes": "npm:^1.3.1" + "@scure/base": "npm:^1.1.3" + "@types/debug": "npm:^4.1.7" + debug: "npm:^4.3.4" + pony-cause: "npm:^2.1.10" + semver: "npm:^7.5.4" + uuid: "npm:^9.0.1" + checksum: 10/68a42a55f7dc750b75467fb7c05a496c20dac073a2753e0f4d9642c4d8dcb3f9ddf51a09d30337e11637f1777f3dfe22e15b5159dbafb0fdb7bd8c9236056153 + languageName: node + linkType: hard + +"@metamask/utils@npm:^9.0.0": version: 9.0.0 resolution: "@metamask/utils@npm:9.0.0" dependencies: From cb032c23721d9778f375fd39b3094aa02fff6bf8 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 3 Jul 2024 15:08:11 -0400 Subject: [PATCH 32/47] Bump `@metamask/chain-api` from `^0.0.1` to `^0.1.0` --- packages/chain-controller/package.json | 2 +- yarn.lock | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 9ec43d7673..c51b7433d8 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@metamask/base-controller": "^6.0.0", - "@metamask/chain-api": "^0.0.1", + "@metamask/chain-api": "^0.1.0", "@metamask/keyring-api": "^8.0.0", "@metamask/snaps-controllers": "^8.1.1", "@metamask/snaps-sdk": "^6.0.0", diff --git a/yarn.lock b/yarn.lock index 4a5581d5c1..24fd9a025e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2444,13 +2444,13 @@ __metadata: languageName: unknown linkType: soft -"@metamask/chain-api@npm:^0.0.1": - version: 0.0.1 - resolution: "@metamask/chain-api@npm:0.0.1" +"@metamask/chain-api@npm:^0.1.0": + version: 0.1.0 + resolution: "@metamask/chain-api@npm:0.1.0" dependencies: - "@metamask/utils": "npm:^8.4.0" - superstruct: "npm:1.0.3" - checksum: 10/263c02d591435ade8faf5a6efdaa5efe1d35056d248a15b975794dc05e04402b7c251940d0f376781ff7b3fce133e115fec3ec50f363d9d77614067cb55cae34 + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.0.0" + checksum: 10/45855703cc31f19b35ed6973096377192c8ca595afa9cd12ff90a90a5236bb8cbbbb1f0b6dc9ebe1c2fb6ab887cce266b192c94538a432c786d9b4b4e2536b88 languageName: node linkType: hard @@ -2460,7 +2460,7 @@ __metadata: dependencies: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.0" - "@metamask/chain-api": "npm:^0.0.1" + "@metamask/chain-api": "npm:^0.1.0" "@metamask/keyring-api": "npm:^8.0.0" "@metamask/snaps-controllers": "npm:^8.1.1" "@metamask/snaps-sdk": "npm:^6.0.0" @@ -3923,7 +3923,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0, @metamask/utils@npm:^8.5.0": +"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.5.0": version: 8.5.0 resolution: "@metamask/utils@npm:8.5.0" dependencies: @@ -12257,13 +12257,6 @@ __metadata: languageName: node linkType: hard -"superstruct@npm:1.0.3": - version: 1.0.3 - resolution: "superstruct@npm:1.0.3" - checksum: 10/632b6171ac136b6750e62a55f806cc949b3dbf2b4a7dc70cc85f54adcdf19d21eab9711f04e8a643b7dd622bbd8658366ead924f467adaccb2c8005c133b7976 - languageName: node - linkType: hard - "superstruct@npm:^1.0.3": version: 1.0.4 resolution: "superstruct@npm:1.0.4" From 07fbffc456e34f0ad73f8bca2fef0898e0566ba7 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 3 Jul 2024 15:19:33 -0400 Subject: [PATCH 33/47] Fix lockfile --- yarn.lock | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index 24fd9a025e..e8a0c48c15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3566,17 +3566,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.2.1": - version: 6.3.0 - resolution: "@metamask/rpc-errors@npm:6.3.0" - dependencies: - "@metamask/utils": "npm:^8.3.0" - fast-safe-stringify: "npm:^2.0.6" - checksum: 10/1abec9ba38057277290cb72bdd3bd8a3c02272c03153421e02139a071c5ea44493065bb55ad725237d186466667916190e60209f86507f24e1c01369f7a8feeb - languageName: node - linkType: hard - -"@metamask/rpc-errors@npm:^6.3.1": +"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.2.1, @metamask/rpc-errors@npm:^6.3.1": version: 6.3.1 resolution: "@metamask/rpc-errors@npm:6.3.1" dependencies: From 9ddd7e641e719f4b7800f5322fe4a4b945172c23 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 17:19:58 -0400 Subject: [PATCH 34/47] Replace yarn resolutions for `@metamask/snaps-{sdk,utils}` with wip branch --- package.json | 8 ++--- yarn.lock | 83 ++++++++++------------------------------------------ 2 files changed, 17 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index d2ec8efe09..53657bf179 100644 --- a/package.json +++ b/package.json @@ -45,12 +45,8 @@ "resolutions": { "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", - "@metamask/snaps-sdk@npm:^4.2.0": "patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch", - "@metamask/snaps-sdk@npm:^4.4.2": "patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch", - "@metamask/snaps-sdk@npm:^6.0.0": "patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch", - "@metamask/snaps-utils@npm:^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", - "@metamask/snaps-utils@npm:^7.5.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", - "@metamask/snaps-utils@npm:^7.7.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", + "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732", + "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 100000678f..3bb766752e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3694,7 +3694,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.1.0": +"@metamask/snaps-registry@npm:^3.1.0, @metamask/snaps-registry@npm:^3.2.0": version: 3.2.0 resolution: "@metamask/snaps-registry@npm:3.2.0" dependencies: @@ -3722,77 +3722,34 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@npm:6.0.0": +"@metamask/snaps-sdk@github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732": version: 6.0.0 - resolution: "@metamask/snaps-sdk@npm:6.0.0" + resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732" dependencies: "@metamask/key-tree": "npm:^9.1.1" "@metamask/providers": "npm:^17.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.3.0" - superstruct: "npm:^1.0.3" - checksum: 10/91774ea791423a3cfef4ddbe30fc0351d9bfb9bad071ebce6a74be85cdd9b864b2666785cb6f0e8257a9778bc630f2de71544258d0367a93917ffe3d72ef90a5 - languageName: node - linkType: hard - -"@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch": - version: 6.0.0 - resolution: "@metamask/snaps-sdk@patch:@metamask/snaps-sdk@npm%3A6.0.0#~/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch::version=6.0.0&hash=8f563d" - dependencies: - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/providers": "npm:^17.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.3.0" - superstruct: "npm:^1.0.3" - checksum: 10/25a89c5b0966482e894768bf6e5acf7dd23aff8e6d72e940528059cd06b71e15bc2aad1e0edd1362f4083643e0eac162ded7ea6b75df10e68998f68fa641566a - languageName: node - linkType: hard - -"@metamask/snaps-utils@npm:7.7.0": - version: 7.7.0 - resolution: "@metamask/snaps-utils@npm:7.7.0" - dependencies: - "@babel/core": "npm:^7.23.2" - "@babel/types": "npm:^7.23.0" - "@metamask/base-controller": "npm:^6.0.0" - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/slip44": "npm:^3.1.0" - "@metamask/snaps-registry": "npm:^3.1.0" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/utils": "npm:^8.3.0" - "@noble/hashes": "npm:^1.3.1" - "@scure/base": "npm:^1.1.1" - chalk: "npm:^4.1.2" - cron-parser: "npm:^4.5.0" - fast-deep-equal: "npm:^3.1.3" - fast-json-stable-stringify: "npm:^2.1.0" - fast-xml-parser: "npm:^4.3.4" - marked: "npm:^12.0.1" - rfdc: "npm:^1.3.0" - semver: "npm:^7.5.4" - ses: "npm:^1.1.0" - superstruct: "npm:^1.0.3" - validate-npm-package-name: "npm:^5.0.0" - checksum: 10/ac5b216b81157f71244e5922befccb214be402f0f5b784086cea46d7b0142f14f555ec7986cb7c867d1b99bfe43b08a687d8db22db85fada55764c2f4afcff97 + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.0.0" + checksum: 10/9e6e768e1ff1906170e517dbf59006601c54fcb1c9fe1be6b81af8b25b2807292fc201affcf40003684332dd0e904529ae5b8d7646ebb7fe3fc981e2e7862ac1 languageName: node linkType: hard -"@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch": +"@metamask/snaps-utils@github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732": version: 7.7.0 - resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch::version=7.7.0&hash=2f2f4c" + resolution: "@metamask/snaps-utils@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" "@metamask/base-controller": "npm:^6.0.0" "@metamask/key-tree": "npm:^9.1.1" "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/slip44": "npm:^3.1.0" - "@metamask/snaps-registry": "npm:^3.1.0" + "@metamask/snaps-registry": "npm:^3.2.0" "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/utils": "npm:^8.3.0" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.0.0" "@noble/hashes": "npm:^1.3.1" "@scure/base": "npm:^1.1.1" chalk: "npm:^4.1.2" @@ -3804,9 +3761,8 @@ __metadata: rfdc: "npm:^1.3.0" semver: "npm:^7.5.4" ses: "npm:^1.1.0" - superstruct: "npm:^1.0.3" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/e72506593957f87678ccbd66c316c933d5b9e01f4ca2b104e8f3e1fa8de384e9570ba4f1ce12692e62e64610625947491db18bcc8aeff89c7cea848cf08c5222 + checksum: 10/254c7899c36c6460ca2dc0f79d85dac52dbf5fad435d10a941cf147bf69feafc9732d0804d0cda517eb9839389aa4f4c8d47a4a3e929506e8f53564d826be5c3 languageName: node linkType: hard @@ -5086,7 +5042,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.11.0": +"acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": version: 8.12.0 resolution: "acorn@npm:8.12.0" bin: @@ -5095,15 +5051,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10/b688e7e3c64d9bfb17b596e1b35e4da9d50553713b3b3630cf5690f2b023a84eac90c56851e6912b483fe60e8b4ea28b254c07e92f17ef83d72d78745a8352dd - languageName: node - linkType: hard - "aes-js@npm:4.0.0-beta.5": version: 4.0.0-beta.5 resolution: "aes-js@npm:4.0.0-beta.5" From 261638a170e2f327e4836ec1245d71682a65f7a8 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 17:21:32 -0400 Subject: [PATCH 35/47] Remove unnecessary yarn resolution for `@metamask/eth-snap-keyring` --- package.json | 1 - yarn.lock | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 53657bf179..cbc627a4a0 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/eth-snap-keyring": "github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork", "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732", "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732", diff --git a/yarn.lock b/yarn.lock index 3bb766752e..05361a613d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2823,21 +2823,21 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-snap-keyring@github:MetaMask/eth-snap-keyring#replace-superstruct-with-fork": - version: 4.3.0 - resolution: "@metamask/eth-snap-keyring@https://github.com/MetaMask/eth-snap-keyring.git#commit=d97cc2380e13f5ba441bc46ce3760a0ec0053456" +"@metamask/eth-snap-keyring@npm:^4.3.1": + version: 4.3.1 + resolution: "@metamask/eth-snap-keyring@npm:4.3.1" dependencies: "@ethereumjs/tx": "npm:^4.2.0" "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/keyring-api": "npm:^6.3.1" + "@metamask/keyring-api": "npm:^8.0.0" "@metamask/snaps-controllers": "npm:^8.1.1" "@metamask/snaps-sdk": "npm:^4.2.0" "@metamask/snaps-utils": "npm:^7.4.0" - "@metamask/superstruct": "npm:^3.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/utils": "npm:^8.4.0" "@types/uuid": "npm:^9.0.1" + superstruct: "npm:^1.0.3" uuid: "npm:^9.0.0" - checksum: 10/5f74a7d8400191442b9f7177236d19878ccac5b560c9e9839256051e582a7cac91e410d6c5a87c4ae9adb9080c831f780069eba816050bd76ba8652b933b8121 + checksum: 10/6362a499e8e25413bf8039c06e66939104bdb69b9dc22df5a44dd55e32304cffb869d4969755e8b4f3234749c6f382d8bbcdfeafe5a75064e85fa43307dbefee languageName: node linkType: hard @@ -3870,7 +3870,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.5.0": +"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0, @metamask/utils@npm:^8.5.0": version: 8.5.0 resolution: "@metamask/utils@npm:8.5.0" dependencies: From e0ff88384690a11b06bdecdaf2d7ec10c594f71a Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 18:52:31 -0400 Subject: [PATCH 36/47] Remove unused yarn patch files --- ...ask-keyring-api-npm-6.4.0-3a5b2ed69f.patch | 21 - ...ethods-npm-0.38.1-flask.1-081e1eb5b3.patch | 19 - ...amask-snaps-sdk-npm-4.2.0-68c745cc62.patch | 86 -- ...amask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch | 86 -- ...amask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch | 922 ------------------ ...ask-snaps-utils-npm-7.4.0-61301b942a.patch | 39 - ...ask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch | 30 - ...ask-snaps-utils-npm-7.7.0-2cc1f044af.patch | 702 ------------- 8 files changed, 1905 deletions(-) delete mode 100644 .yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch delete mode 100644 .yarn/patches/@metamask-rpc-methods-npm-0.38.1-flask.1-081e1eb5b3.patch delete mode 100644 .yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch delete mode 100644 .yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch delete mode 100644 .yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch delete mode 100644 .yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch delete mode 100644 .yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch delete mode 100644 .yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch diff --git a/.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch b/.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch deleted file mode 100644 index a39efbe336..0000000000 --- a/.yarn/patches/@metamask-keyring-api-npm-6.4.0-3a5b2ed69f.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/dist/superstruct.d.ts b/dist/superstruct.d.ts -index 0297c3e9321713e6b84040e393bdc8a38c75f11b..4758932e7ddc007e36c48568726f278531dcaa07 100644 ---- a/dist/superstruct.d.ts -+++ b/dist/superstruct.d.ts -@@ -1,6 +1,6 @@ - import type { Infer } from 'superstruct'; - import { Struct } from 'superstruct'; --import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct/dist/utils'; -+import type { ObjectSchema, OmitBy, Optionalize, PickBy, Simplify } from 'superstruct'; - declare const ExactOptionalSymbol: unique symbol; - export declare type ExactOptionalTag = { - type: typeof ExactOptionalSymbol; -diff --git a/dist/superstruct.js.map b/dist/superstruct.js.map -index 13f57141d1dff4b920d3da3c2052ac54fa3f4590..aef7c243e6b37fc5a12a9ad71711ccab7922f3ec 100644 ---- a/dist/superstruct.js.map -+++ b/dist/superstruct.js.map -@@ -1 +1 @@ --{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAyE;AAkDzE;;;;;;GAMG;AACH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AAC;IAC/B,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,gCAOC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, assert, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct/dist/utils';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Assert that a value is valid according to a struct.\n *\n * It is similar to superstruct's mask function, but it does not ignore extra\n * properties.\n *\n * @param value - Value to check.\n * @param struct - Struct to validate the value against.\n * @param message - Error message to throw if the value is not valid.\n * @returns The value if it is valid.\n */\nexport function strictMask(\n value: unknown,\n struct: Struct,\n message?: string,\n): Type {\n assert(value, struct, message);\n return value;\n}\n"]} -\ No newline at end of file -+{"version":3,"file":"superstruct.js","sourceRoot":"","sources":["../src/superstruct.ts"],"names":[],"mappings":";;;AACA,6CAAyE;AAkDzE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,MAAc;IAEd,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAQ,CAAC;AACjC,CAAC;AAJD,wBAIC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAY;IAC/B,MAAM,QAAQ,GAAW,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,MAAM,GAA4B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE1E,OAAO,QAAQ,IAAI,MAAM,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,MAA4B;IAE5B,OAAO,IAAI,oBAAM,CAAC;QAChB,GAAG,MAAM;QAET,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACxB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;QAEnD,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CACtB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAa,EAAE,GAAG,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC;AAZD,sCAYC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa,CAC3B,IAAY,EACZ,OAAe;IAEf,OAAO,IAAA,oBAAM,EACX,IAAI,EACJ,CAAC,KAAc,EAAW,EAAE,CAC1B,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CACnD,CAAC;AACJ,CAAC;AATD,sCASC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,UAAU,CACxB,KAAc,EACd,MAA4B,EAC5B,OAAgB;IAEhB,IAAA,oBAAM,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,gCAOC","sourcesContent":["import type { Infer, Context } from 'superstruct';\nimport { Struct, assert, define, object as stObject } from 'superstruct';\nimport type {\n ObjectSchema,\n OmitBy,\n Optionalize,\n PickBy,\n Simplify,\n} from 'superstruct';\n\ndeclare const ExactOptionalSymbol: unique symbol;\n\nexport type ExactOptionalTag = {\n type: typeof ExactOptionalSymbol;\n};\n\n/**\n * Exclude type `Type` from the properties of `Obj`.\n *\n * ```ts\n * type Foo = { a: string | null; b: number };\n * type Bar = ExcludeType;\n * // Bar = { a: string, b: number }\n * ```\n */\nexport type ExcludeType = {\n [K in keyof Obj]: Exclude;\n};\n\n/**\n * Make optional all properties that have the `ExactOptionalTag` type.\n *\n * ```ts\n * type Foo = { a: string | ExactOptionalTag; b: number};\n * type Bar = ExactOptionalize;\n * // Bar = { a?: string; b: number}\n * ```\n */\nexport type ExactOptionalize = OmitBy<\n Schema,\n ExactOptionalTag\n> &\n Partial, ExactOptionalTag>>;\n\n/**\n * Infer a type from an superstruct object schema.\n */\nexport type ObjectType = Simplify<\n ExactOptionalize }>>\n>;\n\n/**\n * Change the return type of a superstruct object struct to support exact\n * optional properties.\n *\n * @param schema - The object schema.\n * @returns A struct representing an object with a known set of properties.\n */\nexport function object(\n schema: Schema,\n): Struct, Schema> {\n return stObject(schema) as any;\n}\n\n/**\n * Check if the current property is present in its parent object.\n *\n * @param ctx - The context to check.\n * @returns `true` if the property is present, `false` otherwise.\n */\nfunction hasOptional(ctx: Context): boolean {\n const property: string = ctx.path[ctx.path.length - 1];\n const parent: Record = ctx.branch[ctx.branch.length - 2];\n\n return property in parent;\n}\n\n/**\n * Augment a struct to allow exact-optional values. Exact-optional values can\n * be omitted but cannot be `undefined`.\n *\n * ```ts\n * const foo = object({ bar: exactOptional(string()) });\n * type Foo = Infer;\n * // Foo = { bar?: string }\n * ```\n *\n * @param struct - The struct to augment.\n * @returns The augmented struct.\n */\nexport function exactOptional(\n struct: Struct,\n): Struct {\n return new Struct({\n ...struct,\n\n validator: (value, ctx) =>\n !hasOptional(ctx) || struct.validator(value, ctx),\n\n refiner: (value, ctx) =>\n !hasOptional(ctx) || struct.refiner(value as Type, ctx),\n });\n}\n\n/**\n * Defines a new string-struct matching a regular expression.\n *\n * Example:\n *\n * ```ts\n * const EthAddressStruct = definePattern('EthAddress', /^0x[0-9a-f]{40}$/iu);\n * ```\n *\n * @param name - Type name.\n * @param pattern - Regular expression to match.\n * @returns A new string-struct that matches the given pattern.\n */\nexport function definePattern(\n name: string,\n pattern: RegExp,\n): Struct {\n return define(\n name,\n (value: unknown): boolean =>\n typeof value === 'string' && pattern.test(value),\n );\n}\n\n/**\n * Assert that a value is valid according to a struct.\n *\n * It is similar to superstruct's mask function, but it does not ignore extra\n * properties.\n *\n * @param value - Value to check.\n * @param struct - Struct to validate the value against.\n * @param message - Error message to throw if the value is not valid.\n * @returns The value if it is valid.\n */\nexport function strictMask(\n value: unknown,\n struct: Struct,\n message?: string,\n): Type {\n assert(value, struct, message);\n return value;\n}\n"]} -\ No newline at end of file diff --git a/.yarn/patches/@metamask-rpc-methods-npm-0.38.1-flask.1-081e1eb5b3.patch b/.yarn/patches/@metamask-rpc-methods-npm-0.38.1-flask.1-081e1eb5b3.patch deleted file mode 100644 index 01ab02aa93..0000000000 --- a/.yarn/patches/@metamask-rpc-methods-npm-0.38.1-flask.1-081e1eb5b3.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/dist/types/restricted/getLocale.d.ts b/dist/types/restricted/getLocale.d.ts -index 2941d2733042664c341776c7bc840ba0813994ca..0188bbd4de0cd013159a36b736ad9baf94c18c92 100644 ---- a/dist/types/restricted/getLocale.d.ts -+++ b/dist/types/restricted/getLocale.d.ts -@@ -1,6 +1,6 @@ - import type { PermissionSpecificationBuilder, ValidPermissionSpecification, RestrictedMethodOptions } from '@metamask/permission-controller'; - import { PermissionType } from '@metamask/permission-controller'; --import type { NonEmptyArray } from '@metamask/utils'; -+import type { Json, NonEmptyArray } from '@metamask/utils'; - import type { MethodHooksObject } from '../utils'; - declare const methodName = "snap_getLocale"; - export declare type GetLocaleMethodHooks = { -@@ -43,5 +43,5 @@ export declare const getLocaleBuilder: Readonly<{ - * @param hooks.getLocale - A function that returns the user selected locale. - * @returns The user selected locale. - */ --export declare function getImplementation({ getLocale }: GetLocaleMethodHooks): (_args: RestrictedMethodOptions) => Promise; -+export declare function getImplementation({ getLocale }: GetLocaleMethodHooks): (_args: RestrictedMethodOptions | Json[]>) => Promise; - export {}; diff --git a/.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch b/.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch deleted file mode 100644 index 8f50ba4d30..0000000000 --- a/.yarn/patches/@metamask-snaps-sdk-npm-4.2.0-68c745cc62.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff --git a/dist/index.js.map b/dist/index.js.map -index 6c595143a30baf9d8d11d37c9a9fd8e99c1d105a..96388eac12d945ff9171aa1e6b2524441f0ced5b 100644 ---- a/dist/index.js.map -+++ b/dist/index.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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G,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} -\ No newline at end of file -+{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9DV;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AACF,CAAC;;;AD3QM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} -\ No newline at end of file -diff --git a/dist/index.mjs.map b/dist/index.mjs.map -index 37e6e42d8b21d05b7c6f47cf0808f7f4649e6e28..ba18c8e411f62a240a246db387e73f5993119ba0 100644 ---- a/dist/index.mjs.map -+++ b/dist/index.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAI,UAAU;AACZ,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;A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X;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAMa,iBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9Dd;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AACF,CAAC;;;AD3QM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union"]} -\ No newline at end of file -+{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { JSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n JSXElementStruct,\n]);\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;A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,SAAO,GAAG,YAAY,cAAc,UAAU,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAMkB,aAAkC,QAAQ,OAAO;AAAA,EAC5D,OAAOlB,SAAO;AAAA,EACd,UAAU,UAAU,CAACW,gBAAeK,cAAaC,WAAU,CAAC;AAAA,EAC5D,SAASX;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAMa,iBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9Dd;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AACF,CAAC;;;AD3QM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union"]} -\ No newline at end of file -diff --git a/dist/jsx/index.js.map b/dist/jsx/index.js.map -index 58ffd5459c481a2dd61558c83f717dfe84d88f93..c4d6c196c62b13f4535ba684956d38d4a46e81a1 100644 ---- a/dist/jsx/index.js.map -+++ b/dist/jsx/index.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACrBxE,IAAMA,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACbtE,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AClBpE,IAAMC,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KAAI;;;ACfpE,IAAMC,QAAO;AAeN,IAAM,SAAS,oBAA8CA,KAAI;;;AC1BxE,IAAMC,QAAO;AAcN,IAAM,UAAU,oBAA+CA,KAAI;;;ACb1E,IAAMC,QAAO;AAaN,IAAM,MAAM,oBAA2CA,KAAI;;;ACXlE,IAAMC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","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAAS,qBAA+C,OAAqB;AAC3E,S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AAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,aACE,4BAAc,KAAK,SACnB,0BAAY,OAAO,MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -diff --git a/dist/jsx/index.mjs.map b/dist/jsx/index.mjs.map -index fab9aed63f9a17d965197d6e16426b13a3d94b98..8116fb46395f99f8a143015db1c8b4e0a610ddc0 100644 ---- a/dist/jsx/index.mjs.map -+++ b/dist/jsx/index.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AA4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACrBxE,IAAMA,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACbtE,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AClBpE,IAAMC,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KA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5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: InputElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren = AddressElement | ImageElement | TextElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AA4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,E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GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} -\ No newline at end of file -diff --git a/dist/jsx/jsx-dev-runtime.js.map b/dist/jsx/jsx-dev-runtime.js.map -index f88a029455fa126ff7cb6ef9eea3d80f22282892..5dc414b70da44cd9e3393696aac15f7b9a923f64 100644 ---- a/dist/jsx/jsx-dev-runtime.js.map -+++ b/dist/jsx/jsx-dev-runtime.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAWO;;;ACjBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AAC3E,aAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,QACpB,mBAAAC,SAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,aAAS,mBAAAC,OAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,0BAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,S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,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAKM,IAAM,aAAoC,QAAQ,QAAQ;AAAA,EAC/D,UAAU;AAAA,QACR,8BAAS,UAAU,KAAC,4BAAO,GAAG,YAAY,cAAc,UAAU,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,YAAkC,QAAQ,OAAO;AAAA,EAC5D,WAAO,4BAAO;AAAA,EACd,UAAU,UAAU,CAAC,eAAe,aAAa,UAAU,CAAC;AAAA,EAC5D,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAWO;;;ACjBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AAC3E,aAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,QACpB,mBAAAC,SAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,aAAS,mBAAAC,OAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,0BAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,SACA;AACA,SAAO,MAAM,OAAO;AAItB;;;AFzCO,IAAM,YAA2B,UAAU,KAAC,4BA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AAAA,EAC/D,UAAU;AAAA,QACR,8BAAS,UAAU,KAAC,4BAAO,GAAG,YAAY,cAAc,UAAU,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,YAAkC,QAAQ,OAAO;AAAA,EAC5D,WAAO,4BAAO;AAAA,EACd,UAAU,UAAU,CAAC,eAAe,aAAa,UAAU,CAAC;AAAA,EAC5D,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -diff --git a/dist/jsx/jsx-dev-runtime.mjs.map b/dist/jsx/jsx-dev-runtime.mjs.map -index 9b27b0cd4eedb8b629fa276f80bf742abda5f2f9..7b16cd30c9cfbd91cc9647f38471dffde4ff44b5 100644 ---- a/dist/jsx/jsx-dev-runtime.mjs.map -+++ b/dist/jsx/jsx-dev-runtime.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AA0BA,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;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at end of file -+{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: InputStruct,\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => JSXElementStruct)),\n ) as unknown as Struct, null>,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AA0BA,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,SAAS,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,SACA;AACA,SAAO,MAAM,OAAO;AAItB;;;AFzCO,IAAM,YAA2B,UAAU,CAAC,OAAO,GAAG,O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Y,cAAc,UAAU,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,YAAkC,QAAQ,OAAO;AAAA,EAC5D,OAAO,OAAO;AAAA,EACd,UAAU,UAAU,CAAC,eAAe,aAAa,UAAU,CAAC;AAAA,EAC5D,SAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAKjE,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGvTO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMA,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["element"]} -\ No newline at end of file -diff --git a/dist/tsconfig.build.tsbuildinfo b/dist/tsconfig.build.tsbuildinfo -index e5734d76312a2f97c8c6e66729166cbf03405d9b..2f08eea89654d55e90ab540b52e9962a13fa583b 100644 ---- a/dist/tsconfig.build.tsbuildinfo -+++ b/dist/tsconfig.build.tsbuildinfo -@@ -1 +1 @@ --{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"00b35725eb9cfb53b568275121003ded0451b325c4cdf8e621c3da0200a7de8a","signature":"44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"bced4502948086d1afc2e3931fa95e125135aec142ae932defd777531044538a","signature":"16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"eb81f1227111d1a4af7080772f41d9766f2317aa8a62ba8f354177ef4ee40e8a","signature":"87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"5eb900501cd7790ef0a0ba0efb190b3c716e7512cd0b2b06ab9897f05f800a80","signature":"8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"04509460deee68bc7741c1b6a45891bafcbeabf665fcb73d7bbb56a757850519","signature":"77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"24145523e59b466efe57f26bf973308cab6c859cf885be0c02161e269dbf0833","signature":"ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"de358de61e5a1484b206d25041c62e946f0ac779b7a98ef60608ecd39bb09f35","signature":"6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"1b20522a1a169d9a7480e79a463d65011f67f65ddbae3a9a86baa75629f6810f","signature":"cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"4b35ad670bc9613bc53b5a9b3f29505cf185b1d403eb44e938041ad1d73b3300","signature":"03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"6b87577f1a3f1847652e14db5381e239038f35863699216747e477699aa735f3","signature":"1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"73c82247029576946f99cca02ebcfb1c2016e77bc94cb3c5df911e8e156ceaf0","signature":"58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3"},{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,291],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,186],[108,154,187],[108,187,188,189,190,191,192],[108,207,216,217,220],[108,207,216,219],[108,207,216,218,220],[108,208,211,212,214],[108,208,209,210],[108,211,212,214,215],[108,208,209,213],[108,219,225],[108,207,216,219,225],[108,216,219,225],[108,216,219,221,222,223,224],[108,207,216,217,218,219,220,225],[108,207,216],[108,154,186,193,194],[108,195],[108,115,154,195,198,199],[108,115,154,186,193,195,198],[108,199],[108,194,195,196,199,200,201,202,203],[108,115,196,198,201],[108,194,201],[108,154,193],[108,154,176],[108,176,177],[108,176,177,178,179],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,208],[108,291,292,293,294,295],[108,291,293],[81,108,115,298],[72,108,115],[108,115,301],[108,303],[108,304,305,307],[96,108,115],[107,108,115,314],[81,108,115],[108,144],[108,320,321],[108,318,319,320],[78,81,108,115,311,312,313],[108,299,313,314,325],[108,306],[78,108,115,329],[79,108,115],[108,333],[108,339],[78,81,83,86,96,107,108,115],[108,344],[108,344,346],[108,345],[108,352,357],[108,350,353],[108,350,353,354,355],[108,352],[108,349,356],[108,351],[78,108,110,115,371,372,374],[108,373],[108,388],[108,376,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,379,380,381,382,383,384,385,386,387,388],[108,377,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,378,380,381,382,383,384,385,386,387,388],[108,376,377,378,379,381,382,383,384,385,386,387,388],[108,376,377,378,379,380,382,383,384,385,386,387,388],[108,376,377,378,379,380,381,383,384,385,386,387,388],[108,376,377,378,379,380,381,382,384,385,386,387,388],[108,376,377,378,379,380,381,382,383,385,386,387,388],[108,376,377,378,379,380,381,382,383,384,386,387,388],[108,376,377,378,379,380,381,382,383,384,385,387,388],[108,376,377,378,379,380,381,382,383,384,385,386,388],[108,376,377,378,379,380,381,382,383,384,385,386,387],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,339,398],[108,398,399,400,401,402],[108,335,336,337,338],[108,115,197],[79,108,115,330],[108,408,447],[108,408,432,447],[108,447],[108,408],[108,408,433,447],[108,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446],[108,433,447],[79,96,108,115,310],[79,81,108,115],[79,108,326],[81,108,115,324],[108,324],[108,323],[108,115,459,460,461,462,463,464,465,466,467,468,469],[108,458,459,468],[108,459,468],[108,451,458,459,468],[108,459],[71,108,458,468],[108,458,459,460,461,462,463,464,465,466,467,469],[78,81,83,96,104,107,108,113,115],[108,473],[78,96,108,115],[108,329],[108,327,328],[108,360],[108,359,360],[108,359],[108,359,360,361,363,364,367,368,369,370],[108,360,364],[108,359,360,361,363,364,365,366],[108,359,364],[108,364,368],[108,360,361,362],[108,361],[108,359,360,364],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,180,283,286],[108,154,283,286],[108,154,251,286],[108,154,181,251,279,283,286,287,288],[108,154,180,181,286],[108,154,286],[108,182,183,184,185,280,282,286],[44,50,108,185,279,286],[44,50,108,184,286],[108,154,281,286],[108,155,286],[108,155,169,286],[108,155,156,166,171,286],[108,155,165,169,286],[108,155,161,286],[108,155,160,162,286],[108,160,161,162,163,286],[108,155,166,286],[108,167,168,286],[108,156,157,158,159,164,165,166,169,170,171,172,173,286],[108,155,174,175,284,285,286],[108,155,175,284,286],[44,50,108,154,155,174,279,283,286],[108,286],[108,266,286],[108,279,286],[108,269,270,271,272,273,274,275,276,277,286],[108,154,227,286],[108,251,275,283,286],[108,227,279,283,286],[50,108,286],[108,227,228,252,255,265,266,267,278,286],[50,108,251,286],[108,279,283,286],[108,226,228,286],[108,228,286],[108,283,286],[108,252,286],[108,154,255,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,264,286],[108,154,257,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283,286],[108,154,226,227,286],[108,204,265,286],[108,154,228,286],[50,108,154,235,249,286],[50,108,154,249,286],[50,108,154,235,236,286],[50,108,235,236,283,286],[50,108,235,236,286],[50,108,235,236,242,243,286],[108,237,238,239,240,241,242,243,244,245,246,247,248,286],[50,108,235,236,237,238,239,240,241,242,243,244,245,246,247,286],[50,108,235,236,237,241,245,283,286],[108,235,249,250,286],[154,181],[154,283],[251],[154,181,251,279,283,287,288],[154,180,181],[154],[44,50,279],[44,50,184],[155],[155,169],[155,156,166,171],[155,165,169],[155,161],[155,160,162],[160,161,162,163],[167,168],[156,157,158,159,164,165,166,169,170,171,172,173],[155,174,175,284,285],[155,174,283],[266],[279],[154,227],[251,275,283],[227,279,283],[50],[227,228,252,255,265,266,267,278],[50,251,286],[279,283],[226,228],[228],[283],[252],[154,255],[154,257],[205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283],[154,226,227],[204,265],[154,228],[50,235,249],[249],[50,235]],"referencedMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,197],[181,198],[288,199],[289,200],[182,201],[183,202],[184,202],[283,203],[280,204],[185,205],[282,206],[155,202],[156,207],[157,207],[158,207],[159,207],[170,207],[171,207],[165,208],[172,209],[173,207],[166,210],[160,207],[162,211],[163,212],[161,207],[164,213],[167,214],[168,207],[169,215],[174,216],[286,217],[285,218],[175,207],[284,219],[227,220],[267,221],[269,202],[270,222],[278,223],[271,202],[272,202],[273,224],[274,202],[276,225],[275,226],[277,227],[268,2],[279,228],[252,229],[205,222],[206,230],[229,231],[230,232],[231,231],[232,220],[233,202],[234,233],[253,234],[254,220],[256,235],[265,236],[258,237],[257,202],[259,202],[260,198],[264,238],[261,233],[262,235],[263,222],[228,239],[266,240],[255,241],[236,242],[250,243],[237,244],[242,245],[238,246],[239,246],[244,247],[240,246],[241,245],[249,248],[243,245],[248,249],[246,250],[247,246],[245,246],[251,251],[235,227]],"exportedModulesMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,252],[181,253],[288,254],[289,255],[182,256],[183,257],[184,257],[283,203],[280,258],[185,259],[155,257],[156,260],[157,260],[158,260],[159,260],[170,260],[171,260],[165,261],[172,262],[173,260],[166,263],[160,260],[162,264],[163,265],[161,260],[164,266],[167,260],[168,260],[169,267],[174,268],[286,269],[285,260],[175,260],[284,270],[267,271],[269,257],[270,272],[278,223],[271,257],[272,257],[273,273],[274,257],[276,274],[275,275],[277,276],[279,277],[252,278],[205,272],[206,279],[229,280],[230,281],[231,280],[233,257],[234,282],[253,283],[256,284],[265,236],[258,285],[257,257],[259,257],[260,253],[264,286],[261,282],[262,284],[263,272],[228,287],[266,288],[255,289],[236,290],[250,291],[237,292],[242,292],[238,292],[239,292],[244,292],[240,292],[241,292],[249,248],[243,292],[248,292],[246,292],[247,292],[245,292],[251,251],[235,276]],"semanticDiagnosticsPerFile":[293,291,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,187,188,189,190,191,193,192,218,220,219,207,215,211,212,216,214,221,222,223,225,224,226,217,195,196,201,199,200,204,202,203,194,177,179,178,180,176,186,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,210,208,209,213,290,296,292,294,295,297,299,300,302,305,304,308,309,315,298,316,145,317,322,318,321,320,314,326,307,306,330,331,332,303,334,340,341,342,343,301,344,345,347,348,358,350,354,356,355,353,357,352,351,373,374,319,375,389,377,378,376,379,380,381,382,383,384,385,386,387,388,390,310,391,392,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,393,394,395,337,396,313,312,397,399,401,398,400,402,403,335,339,198,197,404,405,406,407,338,432,433,408,411,430,431,421,420,418,413,426,424,428,412,425,429,414,415,427,409,416,417,419,423,434,422,410,447,446,441,443,442,435,436,438,440,444,445,437,439,311,448,449,325,323,324,450,451,452,453,372,333,454,455,456,457,470,469,460,461,462,463,464,465,466,459,467,468,458,471,472,473,474,475,118,349,336,281,327,329,328,361,370,359,360,371,366,367,365,369,363,362,368,364,346,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,287,181,288,289,182,183,184,283,280,185,282,155,156,157,158,159,170,171,165,172,173,166,160,162,163,161,164,167,168,169,174,286,285,175,284,227,267,269,270,278,271,272,273,274,276,275,277,268,279,252,205,206,229,230,231,232,233,234,253,254,256,265,258,257,259,260,264,261,262,263,228,266,255,236,250,237,242,238,239,244,240,241,249,243,248,246,247,245,251,235],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} -\ No newline at end of file -+{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"00b35725eb9cfb53b568275121003ded0451b325c4cdf8e621c3da0200a7de8a","signature":"44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"bced4502948086d1afc2e3931fa95e125135aec142ae932defd777531044538a","signature":"16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"eb81f1227111d1a4af7080772f41d9766f2317aa8a62ba8f354177ef4ee40e8a","signature":"87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"5eb900501cd7790ef0a0ba0efb190b3c716e7512cd0b2b06ab9897f05f800a80","signature":"8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"04509460deee68bc7741c1b6a45891bafcbeabf665fcb73d7bbb56a757850519","signature":"77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"24145523e59b466efe57f26bf973308cab6c859cf885be0c02161e269dbf0833","signature":"ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"de358de61e5a1484b206d25041c62e946f0ac779b7a98ef60608ecd39bb09f35","signature":"6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"1b20522a1a169d9a7480e79a463d65011f67f65ddbae3a9a86baa75629f6810f","signature":"cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"4b35ad670bc9613bc53b5a9b3f29505cf185b1d403eb44e938041ad1d73b3300","signature":"03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"6b87577f1a3f1847652e14db5381e239038f35863699216747e477699aa735f3","signature":"1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"73c82247029576946f99cca02ebcfb1c2016e77bc94cb3c5df911e8e156ceaf0","signature":"58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3"},{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,291],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,186],[108,154,187],[108,187,188,189,190,191,192],[108,207,216,217,220],[108,207,216,219],[108,207,216,218,220],[108,208,211,212,214],[108,208,209,210],[108,211,212,214,215],[108,208,209,213],[108,219,225],[108,207,216,219,225],[108,216,219,225],[108,216,219,221,222,223,224],[108,207,216,217,218,219,220,225],[108,207,216],[108,154,186,193,194],[108,195],[108,115,154,195,198,199],[108,115,154,186,193,195,198],[108,199],[108,194,195,196,199,200,201,202,203],[108,115,196,198,201],[108,194,201],[108,154,193],[108,154,176],[108,176,177],[108,176,177,178,179],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,208],[108,291,292,293,294,295],[108,291,293],[81,108,115,298],[72,108,115],[108,115,301],[108,303],[108,304,305,307],[96,108,115],[107,108,115,314],[81,108,115],[108,144],[108,320,321],[108,318,319,320],[78,81,108,115,311,312,313],[108,299,313,314,325],[108,306],[78,108,115,329],[79,108,115],[108,333],[108,339],[78,81,83,86,96,107,108,115],[108,344],[108,344,346],[108,345],[108,352,357],[108,350,353],[108,350,353,354,355],[108,352],[108,349,356],[108,351],[78,108,110,115,371,372,374],[108,373],[108,388],[108,376,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,379,380,381,382,383,384,385,386,387,388],[108,377,378,379,380,381,382,383,384,385,386,387,388],[108,376,377,378,380,381,382,383,384,385,386,387,388],[108,376,377,378,379,381,382,383,384,385,386,387,388],[108,376,377,378,379,380,382,383,384,385,386,387,388],[108,376,377,378,379,380,381,383,384,385,386,387,388],[108,376,377,378,379,380,381,382,384,385,386,387,388],[108,376,377,378,379,380,381,382,383,385,386,387,388],[108,376,377,378,379,380,381,382,383,384,386,387,388],[108,376,377,378,379,380,381,382,383,384,385,387,388],[108,376,377,378,379,380,381,382,383,384,385,386,388],[108,376,377,378,379,380,381,382,383,384,385,386,387],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,339,398],[108,398,399,400,401,402],[108,335,336,337,338],[108,115,197],[79,108,115,330],[108,408,447],[108,408,432,447],[108,447],[108,408],[108,408,433,447],[108,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446],[108,433,447],[79,96,108,115,310],[79,81,108,115],[79,108,326],[81,108,115,324],[108,324],[108,323],[108,115,459,460,461,462,463,464,465,466,467,468,469],[108,458,459,468],[108,459,468],[108,451,458,459,468],[108,459],[71,108,458,468],[108,458,459,460,461,462,463,464,465,466,467,469],[78,81,83,96,104,107,108,113,115],[108,473],[78,96,108,115],[108,329],[108,327,328],[108,360],[108,359,360],[108,359],[108,359,360,361,363,364,367,368,369,370],[108,360,364],[108,359,360,361,363,364,365,366],[108,359,364],[108,364,368],[108,360,361,362],[108,361],[108,359,360,364],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,180,283,286],[108,154,283,286],[108,154,251,286],[108,154,181,251,279,283,286,287,288],[108,154,180,181,286],[108,154,286],[108,182,183,184,185,280,282,286],[44,50,108,185,279,286],[44,50,108,184,286],[108,154,281,286],[108,155,286],[108,155,169,286],[108,155,156,166,171,286],[108,155,165,169,286],[108,155,161,286],[108,155,160,162,286],[108,160,161,162,163,286],[108,155,166,286],[108,167,168,286],[108,156,157,158,159,164,165,166,169,170,171,172,173,286],[108,155,174,175,284,285,286],[108,155,175,284,286],[44,50,108,154,155,174,279,283,286],[108,286],[108,266,286],[108,279,286],[108,269,270,271,272,273,274,275,276,277,286],[108,154,227,286],[108,251,275,283,286],[108,227,279,283,286],[50,108,286],[108,227,228,252,255,265,266,267,278,286],[50,108,251,286],[108,279,283,286],[108,226,228,286],[108,228,286],[108,283,286],[108,252,286],[108,154,255,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,264,286],[108,154,257,286],[108,205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283,286],[108,154,226,227,286],[108,204,265,286],[108,154,228,286],[50,108,154,235,249,286],[50,108,154,249,286],[50,108,154,235,236,286],[50,108,235,236,283,286],[50,108,235,236,286],[50,108,235,236,242,243,286],[108,237,238,239,240,241,242,243,244,245,246,247,248,286],[50,108,235,236,237,238,239,240,241,242,243,244,245,246,247,286],[50,108,235,236,237,241,245,283,286],[108,235,249,250,286],[154,181],[154,283],[251],[154,181,251,279,283,287,288],[154,180,181],[154],[44,50,279],[44,50,184],[155],[155,169],[155,156,166,171],[155,165,169],[155,161],[155,160,162],[160,161,162,163],[167,168],[156,157,158,159,164,165,166,169,170,171,172,173],[155,174,175,284,285],[155,174,283],[266],[279],[154,227],[251,275,283],[227,279,283],[50],[227,228,252,255,265,266,267,278],[50,251,286],[279,283],[226,228],[228],[283],[252],[154,255],[154,257],[205,206,229,230,231,232,233,234,253,254,256,257,258,259,260,261,262,263,283],[154,226,227],[204,265],[154,228],[50,235,249],[249],[50,235]],"referencedMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,197],[181,198],[288,199],[289,200],[182,201],[183,202],[184,202],[283,203],[280,204],[185,205],[282,206],[155,202],[156,207],[157,207],[158,207],[159,207],[170,207],[171,207],[165,208],[172,209],[173,207],[166,210],[160,207],[162,211],[163,212],[161,207],[164,213],[167,214],[168,207],[169,215],[174,216],[286,217],[285,218],[175,207],[284,219],[227,220],[267,221],[269,202],[270,222],[278,223],[271,202],[272,202],[273,224],[274,202],[276,225],[275,226],[277,227],[268,2],[279,228],[252,229],[205,222],[206,230],[229,231],[230,232],[231,231],[232,220],[233,202],[234,233],[253,234],[254,220],[256,235],[265,236],[258,237],[257,202],[259,202],[260,198],[264,238],[261,233],[262,235],[263,222],[228,239],[266,240],[255,241],[236,242],[250,243],[237,244],[242,245],[238,246],[239,246],[244,247],[240,246],[241,245],[249,248],[243,245],[248,249],[246,250],[247,246],[245,246],[251,251],[235,227]],"exportedModulesMap":[[293,1],[291,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[187,18],[188,19],[189,19],[190,2],[191,19],[193,20],[192,19],[218,21],[220,22],[219,23],[207,2],[215,24],[211,25],[212,25],[216,26],[214,27],[221,28],[222,29],[223,30],[225,31],[224,28],[226,32],[217,33],[195,34],[196,35],[201,36],[199,37],[200,38],[204,39],[202,40],[203,41],[194,42],[177,43],[179,2],[178,44],[180,45],[176,46],[186,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[210,56],[208,2],[209,2],[213,25],[290,2],[296,57],[292,1],[294,58],[295,1],[297,12],[299,59],[300,60],[302,61],[305,2],[304,62],[308,63],[309,64],[315,65],[298,66],[316,2],[145,67],[317,2],[322,68],[318,2],[321,69],[320,2],[314,70],[326,71],[307,72],[306,2],[330,73],[331,74],[332,64],[303,2],[334,75],[340,76],[341,2],[342,2],[343,77],[301,64],[344,2],[345,78],[347,79],[348,80],[358,81],[350,2],[354,82],[356,83],[355,82],[353,84],[357,85],[352,86],[351,2],[373,87],[374,88],[319,2],[375,2],[389,89],[377,90],[378,91],[376,92],[379,93],[380,94],[381,95],[382,96],[383,97],[384,98],[385,99],[386,100],[387,101],[388,102],[390,75],[310,2],[391,2],[392,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[393,2],[394,2],[395,2],[337,2],[396,2],[313,2],[312,2],[397,76],[399,151],[401,76],[398,76],[400,151],[402,2],[403,152],[335,2],[339,153],[198,154],[197,2],[404,2],[405,2],[406,155],[407,2],[338,2],[432,156],[433,157],[408,158],[411,158],[430,156],[431,156],[421,156],[420,159],[418,156],[413,156],[426,156],[424,156],[428,156],[412,156],[425,156],[429,156],[414,156],[415,156],[427,156],[409,156],[416,156],[417,156],[419,156],[423,156],[434,160],[422,156],[410,156],[447,161],[446,2],[441,160],[443,162],[442,160],[435,160],[436,160],[438,160],[440,160],[444,162],[445,162],[437,162],[439,162],[311,163],[448,164],[449,165],[325,166],[323,167],[324,168],[450,66],[451,2],[452,2],[453,64],[372,2],[333,2],[454,2],[455,2],[456,2],[457,2],[470,169],[469,170],[460,171],[461,172],[462,172],[463,171],[464,171],[465,171],[466,173],[459,174],[467,170],[468,175],[458,2],[471,2],[472,176],[473,2],[474,177],[475,178],[118,2],[349,2],[336,2],[281,2],[327,179],[329,180],[328,179],[361,181],[370,182],[359,2],[360,183],[371,184],[366,185],[367,186],[365,187],[369,188],[363,189],[362,190],[368,191],[364,182],[346,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[287,252],[181,253],[288,254],[289,255],[182,256],[183,257],[184,257],[283,203],[280,258],[185,259],[155,257],[156,260],[157,260],[158,260],[159,260],[170,260],[171,260],[165,261],[172,262],[173,260],[166,263],[160,260],[162,264],[163,265],[161,260],[164,266],[167,260],[168,260],[169,267],[174,268],[286,269],[285,260],[175,260],[284,270],[267,271],[269,257],[270,272],[278,223],[271,257],[272,257],[273,273],[274,257],[276,274],[275,275],[277,276],[279,277],[252,278],[205,272],[206,279],[229,280],[230,281],[231,280],[233,257],[234,282],[253,283],[256,284],[265,236],[258,285],[257,257],[259,257],[260,253],[264,286],[261,282],[262,284],[263,272],[228,287],[266,288],[255,289],[236,290],[250,291],[237,292],[242,292],[238,292],[239,292],[244,292],[240,292],[241,292],[249,248],[243,292],[248,292],[246,292],[247,292],[245,292],[251,251],[235,276]],"semanticDiagnosticsPerFile":[293,291,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,187,188,189,190,191,193,192,218,220,219,207,215,211,212,216,214,221,222,223,225,224,226,217,195,196,201,199,200,204,202,203,194,177,179,178,180,176,186,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,210,208,209,213,290,296,292,294,295,297,299,300,302,305,304,308,309,315,298,316,145,317,322,318,321,320,314,326,307,306,330,331,332,303,334,340,341,342,343,301,344,345,347,348,358,350,354,356,355,353,357,352,351,373,374,319,375,389,377,378,376,379,380,381,382,383,384,385,386,387,388,390,310,391,392,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,393,394,395,337,396,313,312,397,399,401,398,400,402,403,335,339,198,197,404,405,406,407,338,432,433,408,411,430,431,421,420,418,413,426,424,428,412,425,429,414,415,427,409,416,417,419,423,434,422,410,447,446,441,443,442,435,436,438,440,444,445,437,439,311,448,449,325,323,324,450,451,452,453,372,333,454,455,456,457,470,469,460,461,462,463,464,465,466,459,467,468,458,471,472,473,474,475,118,349,336,281,327,329,328,361,370,359,360,371,366,367,365,369,363,362,368,364,346,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,287,181,288,289,182,183,184,283,280,185,282,155,156,157,158,159,170,171,165,172,173,166,160,162,163,161,164,167,168,169,174,286,285,175,284,227,267,269,270,278,271,272,273,274,276,275,277,268,279,252,205,206,229,230,231,232,233,234,253,254,256,265,258,257,259,260,264,261,262,263,228,266,255,236,250,237,242,238,239,244,240,241,249,243,248,246,247,245,251,235],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} -\ No newline at end of file -diff --git a/dist/types/internals/jsx.d.ts b/dist/types/internals/jsx.d.ts -index 95a075622f84c1a90d0156f4c4fe30e3b3274aed..843448bcb514a3054c393683524e5eaec8b2cff0 100644 ---- a/dist/types/internals/jsx.d.ts -+++ b/dist/types/internals/jsx.d.ts -@@ -1,5 +1,5 @@ - import type { Infer, Struct } from 'superstruct'; --import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct/dist/utils'; -+import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct'; - import type { EmptyObject } from '../types'; - /** - * Check if a type is a union. Infers `true` if it is a union, otherwise -diff --git a/dist/types/internals/structs.d.ts b/dist/types/internals/structs.d.ts -index bbfc1289001614aa48dca8aef392f619be8281bb..a79728b0db71449e5fd96f668810856b5b8d54a4 100644 ---- a/dist/types/internals/structs.d.ts -+++ b/dist/types/internals/structs.d.ts -@@ -1,6 +1,6 @@ - import type { Infer } from 'superstruct'; - import { Struct } from 'superstruct'; --import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; -+import type { AnyStruct, InferStructTuple } from 'superstruct'; - import type { EnumToUnion } from './helpers'; - /** - * A wrapper of `superstruct`'s `literal` struct that also defines the name of diff --git a/.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch b/.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch deleted file mode 100644 index 0dae7848a6..0000000000 --- a/.yarn/patches/@metamask-snaps-sdk-npm-4.4.1-f1f7bb22cb.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff --git a/dist/index.js.map b/dist/index.js.map -index da7feadc6949b1fc3ebe7239b4f25db8583c47aa..e146a5978b99b12d9b717e5233099ca4027a3d64 100644 ---- a/dist/index.js.map -+++ b/dist/index.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAA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,CAACN,gBAAeI,cAAaC,aAAY,WAAW,CAAC;AAAA,EACzE,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCV;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_utils","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} -\ No newline at end of file -+{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAA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aC,aAAY,WAAW,CAAC;AAAA,EACzE,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCV;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,mCAAS,6BAAO,CAAC,CAAC;AAE3D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,mCAAS,6BAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;","names":["error","superstructLiteral","superstructUnion","import_utils","svg","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_utils","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} -\ No newline at end of file -diff --git a/dist/index.mjs.map b/dist/index.mjs.map -index 6771a643c5401d86a99a6ebcc5301082de0b36c7..23de547d78e851c5e73d3c73c5c80ab5290a41bc 100644 ---- a/dist/index.mjs.map -+++ b/dist/index.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,E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;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DZ;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBH,QAAOC,SAAO,GAAGG,WAAU;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union","JsonStruct"]} -\ No newline at end of file -+{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { assert, hasProperty, isObject } from '@metamask/utils';\nimport { XMLParser } from 'fast-xml-parser';\n\n/**\n * Parse and validate a string as an SVG.\n *\n * @param svg - An SVG string.\n * @returns The SVG, its attributes and children in an object format.\n */\nexport function parseSvg(svg: string) {\n try {\n const trimmed = svg.trim();\n\n assert(trimmed.length > 0);\n\n const parser = new XMLParser({\n ignoreAttributes: false,\n parseAttributeValue: true,\n });\n const parsed = parser.parse(trimmed, true);\n\n assert(hasProperty(parsed, 'svg'));\n\n // Empty SVGs are not returned as objects\n if (!isObject(parsed.svg)) {\n return {};\n }\n\n return parsed.svg;\n } catch {\n throw new Error('Snap icon must be a valid SVG.');\n }\n}\n\n/**\n * Validate that a string is a valid SVG.\n *\n * @param svg - An SVG string.\n * @returns True if the SVG is valid otherwise false.\n */\nexport function isSvg(svg: string) {\n try {\n parseSvg(svg);\n return true;\n } catch {\n return false;\n }\n}\n","// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n parseSvg,\n isSvg,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import { providerErrors, rpcErrors } from '@metamask/rpc-errors';\n\nimport { createSnapError } from './internals';\n\n/**\n * A JSON-RPC 2.0 Internal (-32603) error.\n *\n * This can be thrown by a Snap to indicate that an internal error occurred,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InternalError = createSnapError(rpcErrors.internal);\n\n/**\n * An Ethereum JSON-RPC Invalid Input (-32000) error.\n *\n * This can be thrown by a Snap to indicate that the input to a method is\n * invalid, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const InvalidInputError = createSnapError(rpcErrors.invalidInput);\n\n/**\n * A JSON-RPC 2.0 Invalid Params (-32602) error.\n *\n * This can be thrown by a Snap to indicate that the parameters to a method are\n * invalid, without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidParamsError = createSnapError(rpcErrors.invalidParams);\n\n/**\n * A JSON-RPC 2.0 Invalid Request (-32600) error.\n *\n * This can be thrown by a Snap to indicate that the request is invalid, without\n * crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const InvalidRequestError = createSnapError(rpcErrors.invalidRequest);\n\n/**\n * An Ethereum JSON-RPC Limit Exceeded (-32005) error.\n *\n * This can be thrown by a Snap to indicate that a limit has been exceeded,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const LimitExceededError = createSnapError(rpcErrors.limitExceeded);\n\n/**\n * An Ethereum JSON-RPC Method Not Found (-32601) error.\n *\n * This can be thrown by a Snap to indicate that a method does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const MethodNotFoundError = createSnapError(rpcErrors.methodNotFound);\n\n/**\n * An Ethereum JSON-RPC Method Not Supported (-32004) error.\n *\n * This can be thrown by a Snap to indicate that a method is not supported,\n * without crashing the Snap.\n */\nexport const MethodNotSupportedError = createSnapError(\n rpcErrors.methodNotSupported,\n);\n\n/**\n * A JSON-RPC 2.0 Parse (-32700) error.\n *\n * This can be thrown by a Snap to indicate that a request is not valid JSON,\n * without crashing the Snap.\n *\n * @see https://www.jsonrpc.org/specification#error_object\n */\nexport const ParseError = createSnapError(rpcErrors.parse);\n\n/**\n * An Ethereum JSON-RPC Resource Not Found (-32001) error.\n *\n * This can be thrown by a Snap to indicate that a resource does not exist,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceNotFoundError = createSnapError(\n rpcErrors.resourceNotFound,\n);\n\n/**\n * An Ethereum JSON-RPC Resource Unavailable (-32002) error.\n *\n * This can be thrown by a Snap to indicate that a resource is unavailable,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const ResourceUnavailableError = createSnapError(\n rpcErrors.resourceUnavailable,\n);\n\n/**\n * An Ethereum JSON-RPC Transaction Rejected (-32003) error.\n *\n * This can be thrown by a Snap to indicate that a transaction was rejected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1474#error-codes\n */\nexport const TransactionRejected = createSnapError(\n rpcErrors.transactionRejected,\n);\n\n/**\n * An Ethereum Provider Chain Disconnected (4901) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected\n * from the requested chain, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const ChainDisconnectedError = createSnapError(\n providerErrors.chainDisconnected,\n);\n\n/**\n * An Ethereum Provider Disconnected (4900) error.\n *\n * This can be thrown by a Snap to indicate that the provider is disconnected,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const DisconnectedError = createSnapError(providerErrors.disconnected);\n\n/**\n * An Ethereum Provider Unauthorized (4100) error.\n *\n * This can be thrown by a Snap to indicate that the requested method / account\n * is not authorized by the user, without crashing the Snap.\n */\nexport const UnauthorizedError = createSnapError(providerErrors.unauthorized);\n\n/**\n * An Ethereum Provider Unsupported Method (4200) error.\n *\n * This can be thrown by a Snap to indicate that the requested method is not\n * supported by the provider, without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UnsupportedMethodError = createSnapError(\n providerErrors.unsupportedMethod,\n);\n\n/**\n * An Ethereum Provider User Rejected Request (4001) error.\n *\n * This can be thrown by a Snap to indicate that the user rejected the request,\n * without crashing the Snap.\n *\n * @see https://eips.ethereum.org/EIPS/eip-1193#provider-errors\n */\nexport const UserRejectedRequestError = createSnapError(\n providerErrors.userRejectedRequest,\n);\n","import { assert, bytesToBase64 } from '@metamask/utils';\n\nimport { image } from './ui';\n\n/**\n * Get raw image data from a URL.\n *\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a blob.\n */\nasync function getRawImageData(url: string, options?: RequestInit) {\n if (typeof fetch !== 'function') {\n throw new Error(\n `Failed to fetch image data from \"${url}\": Using this function requires the \"endowment:network-access\" permission.`,\n );\n }\n\n return fetch(url, options).then(async (response) => {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(string())),\n name: string(),\n }),\n);\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: string(),\n }),\n);\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an {@link UserInputEventType.FormSubmitEvent} is fired.\n * It contains the form values submitted.\n */\nexport type UserInputEvent = Infer;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of\n * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const FormStateStruct = record(string(), nullable(string()));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(string())]),\n);\n\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA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,IAAM,mBAAyC,UAAU;AAAA,EAC9DZ;AAAA,EACAG;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ADtVM,IAAM,kBAAkBG,QAAOC,SAAO,GAAGC,UAASD,SAAO,CAAC,CAAC;AAE3D,IAAM,uBAAuBD;AAAA,EAClCC,SAAO;AAAA,EACPE,OAAM,CAAC,iBAAiBD,UAASD,SAAO,CAAC,CAAC,CAAC;AAC7C;AAMO,IAAM,2BAA2BE,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBH,QAAOC,SAAO,GAAGG,WAAU;","names":["error","hasProperty","isObject","svg","assert","assert","assign","literal","object","node","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","string","string","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","assert","SeverityLevel","assign","literal","object","optional","string","union","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","object","record","string","string","object","record","nullable","array","ButtonStruct","optional","boolean","InputStruct","FormStruct","lazy","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","record","string","nullable","union","JsonStruct"]} -\ No newline at end of file -diff --git a/dist/jsx/index.js.map b/dist/jsx/index.js.map -index 4cda1449ef3341a5cdc62075e62c1d2850fc8be2..92f7a08191f98c0aae8f43bb15606a5d7aba0c7c 100644 ---- a/dist/jsx/index.js.map -+++ b/dist/jsx/index.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAmBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACvB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACdxE,IAAMC,QAAO;AAiBN,IAAM,QAAQ,oBAA6CA,KAAI;;;AChBtE,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AClBpE,IAAMC,QAAO;AAgBN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,QAAO;AAcN,IAAM,OAAO,oBAA4CA,KAAI;;;ACfpE,IAAMC,QAAO;AAeN,IAAM,SAAS,oBAA8CA,KAAI;;;AC1BxE,IAAMC,QAAO;AAcN,IAAM,UAAU,oBAA+CA,KAAI;;;ACT1E,IAAMC,SAAO;AAaN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IAAM,gBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,aACE,4BAAc,KAAK,SACnB,0BAAY,OAAO,MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4EA,S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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,aACE,4BAAc,KAAK,SACnB,0BAAY,OAAO,MAAM,SACzB,0BAAY,OAAO,OAAO,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -diff --git a/dist/jsx/index.mjs.map b/dist/jsx/index.mjs.map -index 37d1e93ebb4c7b96ee2c97403070041d5294643b..7698f9a5a6cb65f1b620f9ddc713b8d1c9eacffe 100644 ---- a/dist/jsx/index.mjs.map -+++ b/dist/jsx/index.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AA4EA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;AC7EA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAmBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACvB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACdxE,IAAMC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E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type MaybeArrayString = MaybeArray;\n * const maybeArrayString: MaybeArrayString = 'hello';\n * const maybeArrayStringArray: MaybeArrayString = ['hello', 'world'];\n */\nexport type MaybeArray = Type | Type[];\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = MaybeArray;\n\n/**\n * A JSX string element, which can be a string or an array of strings.\n */\nexport type StringElement = MaybeArray;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\ntype DropdownProps = {\n name: string;\n value?: string;\n children: MaybeArray;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { DropdownElement } from './Dropdown';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children: [InputElement, ButtonElement] | InputElement | DropdownElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import type { MaybeArray } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { FieldElement } from './Field';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The form fields. See {@link Field}.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\ntype FormProps = {\n children: MaybeArray;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\ntype InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field. This component\n * can only be used as a child of the {@link Field} component.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, MaybeArray, SnapElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = MaybeArray<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n | null\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: MaybeArray;\n direction?: 'vertical' | 'horizontal';\n alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = MaybeArray<\n string | StandardFormattingElement | null\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'error';\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { MaybeArray } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = MaybeArray<\n string | StandardFormattingElement | LinkElement | null\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","element"]} -\ No newline at end of file -diff --git a/dist/jsx/jsx-dev-runtime.js.map b/dist/jsx/jsx-dev-runtime.js.map -index 48aa98ff1c8e93e24d2d7aab993b5086c0e26e73..5eeb9d4013a09181b0259eabf0810ecfb1957230 100644 ---- a/dist/jsx/jsx-dev-runtime.js.map -+++ b/dist/jsx/jsx-dev-runtime.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAYO;;;AClBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AAC3E,aAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,QACpB,mBAAAC,SAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,aAAS,mBAAAC,OAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,0BAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,SACA;AACA,SAAO,MAAM,OAAO;AAItB;;;AFrCO,IAAM,YAA2B,UAAU,KAAC,4BAAO,OAAG,4BAAO,CAAC,CAAC;AAK/D,IAAM,sBAA+C;AAAA,MAC1D,4BAAO;AACT;AAKO,IAAM,oBAA8C,4BAAO;AAAA,EAChE,UAAM,4BAAO;AAAA,EACb,WAAO,gCAAO,4BAAO,GAAG,uBAAU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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA,mBAKO;AAEP,IAAAA,sBAYO;;;AClBP,yBAKO;AA0BA,SAAS,QAAgD,OAAa;AAC3E,aAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,QACpB,m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AAA,EACd,UAAU,UAAU,CAAC,eAAe,aAAa,YAAY,WAAW,CAAC;AAAA,EACzE,aAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,CAAC,CAAC;AAAA,EACtE;AACF,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,aAAO,wBAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AFnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["import_superstruct","superstructLiteral","superstructUnion","element"]} -\ No newline at end of file -diff --git a/dist/jsx/jsx-dev-runtime.mjs.map b/dist/jsx/jsx-dev-runtime.mjs.map -index 969a7caaed03191c746822b48f5beb8220840536..abe0078924086a27b43e17c1a3dfd2ce03be6164 100644 ---- a/dist/jsx/jsx-dev-runtime.mjs.map -+++ b/dist/jsx/jsx-dev-runtime.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AClBP;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AA0BA,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,SAAS,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;;AC0BO,SAAS,UACd,SACA;AAC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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AGnYO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMA,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type { ObjectSchema } from 'superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n MaybeArray,\n SnapElement,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n ValueElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = maybeArray(\n string(),\n);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link MaybeArray} type.\n *\n * @param struct - The struct for the maybe array type.\n * @returns The struct for the maybe array type.\n */\nfunction maybeArray(\n struct: Struct,\n): Struct, any> {\n return nullUnion([struct, array(struct)]);\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: maybeArray(OptionStruct),\n});\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n InputStruct,\n DropdownStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: maybeArray(nullUnion([FieldStruct, ButtonStruct])),\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: maybeArray(\n nullable(\n nullUnion([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n ),\n ),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: maybeArray(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n nullable(lazy(() => BoxChildStruct)),\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: string(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: maybeArray(nullable(nullUnion([FormattingStruct, string()]))),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: maybeArray(\n nullable(nullUnion([string(), BoldStruct, ItalicStruct, LinkStruct])),\n ),\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('error')]),\n ),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set should include all components, except components that need to be nested\n * in another component (e.g. Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n ButtonStruct,\n InputStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n) {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,E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AAExB,SAAOA;AACT;","names":["element"]} -\ No newline at end of file -diff --git a/dist/tsconfig.build.tsbuildinfo b/dist/tsconfig.build.tsbuildinfo -index e7e9da52b4541db95e7e7c67522dc5006a76adb9..381d393659da9e27e8f43843f54bd9fe9fbfb254 100644 ---- a/dist/tsconfig.build.tsbuildinfo -+++ b/dist/tsconfig.build.tsbuildinfo -@@ -1 +1 @@ --{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Option.ts","../src/jsx/components/form/Dropdown.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Value.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","d6e6620a30d582182acc3f0a992a0c311adc589f111096aea11ab83fc09a5ccc","6213b8f686f56beab22b59a0f468590fd3a4c5fa931236a017efeca91d7c9584","c451cec9a588b1f105a5ea2c6063d4fca112b9d70105cacdadda0e1ef67e9379","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"d5d9407858477b9fb1d5127bb1da9d0532799e98f2d765ca0f83d7e0617aead9","signature":"c7298e68632ab03155f6de963d3d09cc4a5874c28a81524f56c667d8a052e538"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"89c7df2ac4b33507472aa18cfbdac688e7e0b749ee584d9d41884721c4e603c6","signature":"6ee568039016b81ed70292a595ab781ab978cba4243a5fe49507040ee4f7ac8a"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"a3c40e930415aa32fdcdb14f90688010d19fda009833d7dd93abcc71e03dd8af","signature":"a68bb369c4ba8ab43a78f3fad2d3ec130e1418bc946521b9c84e9b336d6e88f1"},{"version":"0b4c309c6b8685487f97d6fd6a7441b93dd4ca3c4a8f2bcc96a55e5f9d28eee2","signature":"65f219e6e1f9d27c677a49d41ae7989b83bf6baa56debbeb50d95c3ab21632e2"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"854caddc363811a2917620e1ef1a986fceec21e1c695561c7122859df49e0431","signature":"c89354ae268153d965011e484150f0c92faa87f3f66507c25b496973178e0400"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"a1d7df4a3dbe98d0633eeca6be38c65827d29865fe8d48a1005e9aad0fa3cbb9","signature":"a6f4816a634bb1ceb513634c1ef7c0535f461ed2565336eed69f6ac2babbe15b"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"d1121f9f0f812490afd777a543b1412ea50ea95da6f5e83f5d8b8617c2ca0ec4","signature":"608c45069e89c4c8f0ab29f896cc93c6553808072d6304b23611b6c6de3c24bb"},{"version":"1db66cc3eb3ef433289a7fcbac5c9bd9bfdde251188cc5886e016b8e60953aa7","signature":"22cbabe752781b5f35482af9d1fcf1455cb1ece74e8b84700d4abcb44abe3776"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"8bdd4f7af884080d0c18ee346e3ffcc433824d67fde761a71879fea59c8648d3","signature":"a5d1209c7bf277af86281392d46e12ce3dd6052586053f757fb2e606cc75c0f3"},{"version":"ad21d1b3fe8673f3e0dc0e8a592016ca4158a9414471c6d6531aff27713c3e51","signature":"c1f11d9b42bfb0823d34d93c58df91ffb6690b5a717b7d310d83f258f1784e58"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"710e8c05b091c0294e0d0df1a734f78fc32293cbf10f51cc91880bc9e0b0a0c6","signature":"775b207f00d4df5b3b0b536aa696d572cdd2cabe8ea18dd28e8b52f691fa2a55"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"c485c6497f7587314c4c4a59b74850cbca4c0c4bc08146a918cfd237ef821dbb"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"e9eec004735b1bf7015edf5400aeb914a53132134d230e93786590d904d094cc"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"f46ba7c6fa7fcc8b3d57c4618c18db3f4d8bfe1fcab5551d7f6d9a82cf4d6078"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"977f9752e7185453337e20609747d21846556482c0f1658e29edd182985cafbc","signature":"4e7ac7e5dd58a6c29c724728b031669e3068b194b62c2b83f92e76a36cb34dbb"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"82c5caf9da87baeacfa390572521720578ce4951590a8539482aed97b8c18514","signature":"79576487ac18e047e8192fc582ff488ce375fe4df0cb028a17f831cf42b976f2"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"518d468edb1e58fe5187cd892d3096ae7764a5f6c759303c508a5172a1ec0e62","signature":"db34610570eed46b8b72bc662a91261200b8578af0ac02781ce7d9aca99bc683"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,294],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,167],[108,154,168],[108,168,169,170,171,172,173],[108,188,197,198,201],[108,188,197,200],[108,188,197,199,201],[108,189,192,193,195],[108,189,190,191],[108,192,193,195,196],[108,189,190,194],[108,200,206],[108,188,197,200,206],[108,197,200,206],[108,197,200,202,203,204,205],[108,188,197,198,199,200,201,206],[108,188,197],[108,154,167,174,175],[108,176],[108,115,154,176,179,180],[108,115,154,167,174,176,179],[108,180],[108,175,176,177,180,181,182,183,184],[108,115,177,179,182],[108,175,182],[108,154,174],[108,154,157],[108,157,158],[108,157,158,159,160],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,189],[108,294,295,296,297,298],[108,294,296],[81,108,115,301],[72,108,115],[108,115,304],[108,306],[108,307,308,310],[96,108,115],[107,108,115,317],[81,108,115],[108,144],[108,323,324],[108,321,322,323],[78,81,108,115,314,315,316],[108,302,316,317,328],[108,309],[78,108,115,332],[79,108,115],[108,336],[108,342],[78,81,83,86,96,107,108,115],[108,347],[108,347,349],[108,348],[108,355,360],[108,353,356],[108,353,356,357,358],[108,355],[108,352,359],[108,354],[78,108,110,115,374,375,377],[108,376],[108,391],[108,379,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,382,383,384,385,386,387,388,389,390,391],[108,380,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,381,383,384,385,386,387,388,389,390,391],[108,379,380,381,382,384,385,386,387,388,389,390,391],[108,379,380,381,382,383,385,386,387,388,389,390,391],[108,379,380,381,382,383,384,386,387,388,389,390,391],[108,379,380,381,382,383,384,385,387,388,389,390,391],[108,379,380,381,382,383,384,385,386,388,389,390,391],[108,379,380,381,382,383,384,385,386,387,389,390,391],[108,379,380,381,382,383,384,385,386,387,388,390,391],[108,379,380,381,382,383,384,385,386,387,388,389,391],[108,379,380,381,382,383,384,385,386,387,388,389,390],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,342,401],[108,401,402,403,404,405],[108,338,339,340,341],[108,115,178],[79,108,115,333],[108,411,450],[108,411,435,450],[108,450],[108,411],[108,411,436,450],[108,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449],[108,436,450],[79,96,108,115,313],[79,81,108,115],[79,108,329],[81,108,115,327],[108,327],[108,326],[108,115,462,463,464,465,466,467,468,469,470,471,472],[108,461,462,471],[108,462,471],[108,454,461,462,471],[108,462],[71,108,461,471],[108,461,462,463,464,465,466,467,468,469,470,472],[78,81,83,96,104,107,108,113,115],[108,476],[78,96,108,115],[108,332],[108,330,331],[108,363],[108,362,363],[108,362],[108,362,363,364,366,367,370,371,372,373],[108,363,367],[108,362,363,364,366,367,368,369],[108,362,367],[108,367,371],[108,363,364,365],[108,364],[108,362,363,367],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,156,161,289],[108,154,156,289],[108,154,156,257],[108,154,156,162,257,285,289,290,291],[108,154,156,161,162],[108,154,156],[108,156,163,164,165,166,286,288],[44,50,108,156,166,285],[44,50,108,156,165],[108,154,156,287],[108,155,156],[108,155,156,231],[108,155,156,216,228,233,234],[108,155,156,227,231],[108,155,156,221],[108,155,156,220,222,223],[108,155,156,220,224],[108,156,220,221,222,223,224,225],[108,155,156,228],[108,156,229,230],[108,156,216,217,218,219,226,227,228,231,232,233,234,235,236],[108,155,156,237,238,239],[108,155,156,238],[44,50,108,154,155,156,237,285,289],[108,156],[108,156,272],[108,156,285],[108,156,275,276,277,278,279,280,281,282,283],[108,154,156,208],[108,156,257,281,289],[108,156,208,285,289],[50,108,156,258],[108,156,208,209,258,261,271,272,273,284],[50,108,154,156,240,257],[108,156,285,289],[108,156,207,209],[108,156,209],[108,156,289],[108,156,258],[108,154,156,261],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,270],[108,154,156,263],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[108,154,156,207,208],[108,156,185,271],[108,154,156,209],[50,108,154,156,241,255],[50,108,154,156,255],[50,108,154,156,241,242],[50,108,156,241,242,289],[50,108,156,241,242],[50,108,156,241,242,248,249],[108,156,243,244,245,246,247,248,249,250,251,252,253,254],[50,108,156,241,242,243,244,245,246,247,248,249,250,251,252,253],[50,108,156,241,242,243,247,251,289],[108,156,241,255,256],[50,108,156],[154,162],[154,289],[257],[154,162,257,285,289,290,291],[154,161,162],[154],[44,50,285],[44,50,165],[155],[155,231],[155,216,228,233,234],[155,227,231],[155,221],[155,220,222,223],[155,220,224],[220,221,222,223,224,225],[229,230],[216,217,218,219,226,227,228,231,232,233,234,235,236],[155,156,237,238,239],[50,155,237,289],[272],[285],[154,208],[257,281,289],[208,285,289],[50,258],[208,209,258,261,271,272,273,284],[50,154,240,257],[285,289],[207,209],[209],[289],[258],[154,261],[154,263],[186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[154,207,208],[185,271],[154,209],[50,241,255],[255],[50,241],[50]],"referencedMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,197],[162,198],[291,199],[292,200],[163,201],[164,202],[165,202],[289,203],[286,204],[166,205],[288,206],[155,202],[216,207],[217,207],[218,207],[219,207],[232,207],[233,207],[227,208],[235,209],[236,207],[228,210],[234,207],[220,207],[222,211],[224,212],[225,213],[223,207],[221,207],[226,214],[229,215],[230,207],[231,216],[237,217],[240,218],[239,219],[156,207],[238,220],[208,221],[273,222],[275,202],[276,223],[284,224],[277,202],[278,221],[279,225],[280,202],[282,226],[281,227],[283,228],[274,2],[285,229],[258,230],[186,223],[187,231],[210,232],[211,233],[212,232],[213,221],[214,202],[215,234],[259,235],[260,221],[262,236],[271,237],[264,238],[263,202],[265,202],[266,198],[270,239],[267,234],[268,236],[269,223],[209,240],[272,241],[261,242],[242,243],[256,244],[243,245],[248,246],[244,247],[245,247],[250,248],[246,247],[247,246],[255,249],[249,246],[254,250],[252,251],[253,247],[251,247],[257,252],[241,253]],"exportedModulesMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,254],[162,255],[291,256],[292,257],[163,258],[164,259],[165,259],[289,203],[286,260],[166,261],[155,259],[216,262],[217,262],[218,262],[219,262],[232,262],[233,262],[227,263],[235,264],[236,262],[228,265],[234,262],[220,262],[222,266],[224,267],[225,268],[223,262],[221,262],[226,269],[229,262],[230,262],[231,270],[237,271],[240,272],[239,262],[156,262],[238,273],[273,274],[275,259],[276,275],[284,224],[277,259],[279,276],[280,259],[282,277],[281,278],[283,279],[285,280],[258,281],[186,275],[187,282],[210,283],[211,284],[212,283],[214,259],[215,285],[259,286],[262,287],[271,237],[264,288],[263,259],[265,259],[266,255],[270,289],[267,285],[268,287],[269,275],[209,290],[272,291],[261,292],[242,293],[256,294],[243,295],[248,295],[244,295],[245,295],[250,295],[246,295],[247,295],[255,249],[249,295],[254,295],[252,295],[253,295],[251,295],[257,252],[241,296]],"semanticDiagnosticsPerFile":[296,294,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,168,169,170,171,172,174,173,199,201,200,188,196,192,193,197,195,202,203,204,206,205,207,198,176,177,182,180,181,185,183,184,175,158,160,159,161,157,167,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,191,189,190,194,293,299,295,297,298,300,302,303,305,308,307,311,312,318,301,319,145,320,325,321,324,323,317,329,310,309,333,334,335,306,337,343,344,345,346,304,347,348,350,351,361,353,357,359,358,356,360,355,354,376,377,322,378,392,380,381,379,382,383,384,385,386,387,388,389,390,391,393,313,394,395,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,396,397,398,340,399,316,315,400,402,404,401,403,405,406,338,342,179,178,407,408,409,410,341,435,436,411,414,433,434,424,423,421,416,429,427,431,415,428,432,417,418,430,412,419,420,422,426,437,425,413,450,449,444,446,445,438,439,441,443,447,448,440,442,314,451,452,328,326,327,453,454,455,456,375,336,457,458,459,460,473,472,463,464,465,466,467,468,469,462,470,471,461,474,475,476,477,478,118,352,339,287,330,332,331,364,373,362,363,374,369,370,368,372,366,365,371,367,349,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,290,162,291,292,163,164,165,289,286,166,288,155,216,217,218,219,232,233,227,235,236,228,234,220,222,224,225,223,221,226,229,230,231,237,240,239,156,238,208,273,275,276,284,277,278,279,280,282,281,283,274,285,258,186,187,210,211,212,213,214,215,259,260,262,271,264,263,265,266,270,267,268,269,209,272,261,242,256,243,248,244,245,250,246,247,255,249,254,252,253,251,257,241],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} -\ No newline at end of file -+{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../src/jsx/component.ts","../src/jsx/jsx-runtime.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/helpers.ts","../src/internals/structs.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../src/types/methods/create-interface.ts","../src/types/methods/dialog.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../src/types/caip.ts","../src/types/permissions.ts","../src/types/methods/get-bip32-entropy.ts","../src/types/methods/get-bip32-public-key.ts","../src/types/methods/get-bip44-entropy.ts","../src/types/methods/get-client-status.ts","../src/types/methods/get-entropy.ts","../src/types/methods/get-file.ts","../src/jsx/components/Address.ts","../src/jsx/components/Box.ts","../src/jsx/components/Copyable.ts","../src/jsx/components/Divider.ts","../src/jsx/components/form/Button.ts","../src/jsx/components/form/Option.ts","../src/jsx/components/form/Dropdown.ts","../src/jsx/components/form/Input.ts","../src/jsx/components/form/Field.ts","../src/jsx/components/form/Form.ts","../src/jsx/components/form/index.ts","../src/jsx/components/Link.ts","../src/jsx/components/Text.ts","../src/jsx/components/formatting/Bold.ts","../src/jsx/components/formatting/Italic.ts","../src/jsx/components/formatting/index.ts","../src/jsx/components/Heading.ts","../src/jsx/components/Image.ts","../src/jsx/components/Value.ts","../src/jsx/components/Row.ts","../src/jsx/components/Spinner.ts","../src/jsx/components/index.ts","../src/jsx/validation.ts","../src/jsx/jsx-dev-runtime.ts","../src/jsx/index.ts","../src/ui/nodes.ts","../src/ui/builder.ts","../src/ui/components/address.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/button.ts","../src/ui/components/input.ts","../src/ui/components/form.ts","../src/ui/components/text.ts","../src/ui/components/row.ts","../src/ui/components/spinner.ts","../src/ui/components/panel.ts","../src/ui/components/index.ts","../src/ui/component.ts","../src/ui/index.ts","../src/types/interface.ts","../src/types/methods/get-interface-state.ts","../src/types/methods/get-locale.ts","../src/types/snap.ts","../src/types/methods/get-snaps.ts","../src/types/methods/invoke-snap.ts","../src/types/methods/invoke-keyring.ts","../src/types/methods/manage-accounts.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/methods/request-snaps.ts","../src/types/methods/update-interface.ts","../src/types/methods/methods.ts","../src/types/methods/index.ts","../src/types/provider.ts","../src/types/global.ts","../src/types/images.ts","../src/types/handlers/cronjob.ts","../src/types/handlers/home-page.ts","../src/types/handlers/keyring.ts","../src/types/handlers/lifecycle.ts","../src/types/handlers/name-lookup.ts","../src/types/handlers/rpc-request.ts","../src/types/handlers/transaction.ts","../src/types/handlers/signature.ts","../src/types/handlers/user-input.ts","../src/types/handlers/index.ts","../src/types/index.ts","../src/internals/jsx.ts","../../../node_modules/fast-xml-parser/src/fxp.d.ts","../src/internals/svg.ts","../src/internals/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/chalk/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f",{"version":"3bca0ae756174a48ad9a47c865776f41788793ace1d85736aec31a60fa6ad960","signature":"c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b"},{"version":"e0e6891afe2986f8f41995f02c784c0141f0785f9039c04f42873b041324b738","signature":"31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba"},"9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d",{"version":"7f21c0f417540d8f7049665fe143fdc126f0f49b54be9396346d13f5365656b0","signature":"6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4"},{"version":"5c6af5bcd08565be7bdb15556b7f0ec2a28ba3f9acda87136fbd75871aa2f2bb","signature":"cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff"},{"version":"cf25f0c4e8c185e7235b00e6da5cd1118a54a42a6b03cf400e46ef543b28590d","signature":"9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c"},{"version":"35cf4c47da07028e95286e6b4d78b702cb101beb27b1d1d712209921508ee5d0","signature":"a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0"},{"version":"d0ddd632c4f010cb2a048d8a606e3544f9a8a67a6c1487858e8aa08b6fdeda73","signature":"0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34"},"fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","d6e6620a30d582182acc3f0a992a0c311adc589f111096aea11ab83fc09a5ccc","6213b8f686f56beab22b59a0f468590fd3a4c5fa931236a017efeca91d7c9584","c451cec9a588b1f105a5ea2c6063d4fca112b9d70105cacdadda0e1ef67e9379","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2",{"version":"d5d9407858477b9fb1d5127bb1da9d0532799e98f2d765ca0f83d7e0617aead9","signature":"c7298e68632ab03155f6de963d3d09cc4a5874c28a81524f56c667d8a052e538"},{"version":"9f64beb0e02869eecb1d65c682e6951b18f7d735acc669c4aa666b10802fad58","signature":"3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284"},"5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2",{"version":"8840aa6b6e639356fe03fb90dcf4b5c0f692e19ea21769dfefa87fb4986d0f39","signature":"6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8"},{"version":"3c3bd88dce55082490f23b03004ecd8c0240286b78f0f3a8522741d85149daef","signature":"0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554"},{"version":"75338b5765638e8ebb9db41409c44c7f518ff075659dfa5d9e098b8275d693c0","signature":"5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609"},{"version":"77365935c04df781293bef31693df1f39ab6a1277e5c80b6e6afbb1261ba2e7e","signature":"80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a"},{"version":"f079c0793e2a122623b2a06b69d2eac67c0eb0d0dd93697934575df2c2dc1e5c","signature":"2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643"},{"version":"747d15f60efe408b2591768b982c1c6245aef0e3d723293eab22b72ba3a585d6","signature":"cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3"},{"version":"deccdcc30a0da9b7ab2fa9a72ad35b30e23811adb665ebc785cba2e73b8c5675","signature":"9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94"},{"version":"36232364518da824c104338b98b4b07a47e1d217662a58e114393931aa02594d","signature":"122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45"},{"version":"aa805fc7ff02a27db26c2a528940a8aeca1f750c3a3643bacef479e3257d3662","signature":"9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff"},{"version":"89c7df2ac4b33507472aa18cfbdac688e7e0b749ee584d9d41884721c4e603c6","signature":"6ee568039016b81ed70292a595ab781ab978cba4243a5fe49507040ee4f7ac8a"},{"version":"d8554032764ddef0e0bbbe2e99c833eb8f7578c2b625f5b8eab091188610196b","signature":"043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3"},{"version":"cb8e681140450ef21ae1a541655fb0c1fefa0d5bbc8570f7530ea7ab13db0608","signature":"e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3"},{"version":"c9d671faef655f35974718a841388e5808f3bd94e282e244a9a0d99b14cff495","signature":"5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d"},{"version":"a3c40e930415aa32fdcdb14f90688010d19fda009833d7dd93abcc71e03dd8af","signature":"a68bb369c4ba8ab43a78f3fad2d3ec130e1418bc946521b9c84e9b336d6e88f1"},{"version":"0b4c309c6b8685487f97d6fd6a7441b93dd4ca3c4a8f2bcc96a55e5f9d28eee2","signature":"65f219e6e1f9d27c677a49d41ae7989b83bf6baa56debbeb50d95c3ab21632e2"},{"version":"bfba5e8c8dcb1c4b329dd468ae054a418938168396429902a293f33c3b98d236","signature":"cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef"},{"version":"854caddc363811a2917620e1ef1a986fceec21e1c695561c7122859df49e0431","signature":"c89354ae268153d965011e484150f0c92faa87f3f66507c25b496973178e0400"},{"version":"2a81ff1c24917005c9736de2a457c5564c9c6e11e4d76874da07cf11be8cff91","signature":"f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d"},{"version":"a1d7df4a3dbe98d0633eeca6be38c65827d29865fe8d48a1005e9aad0fa3cbb9","signature":"a6f4816a634bb1ceb513634c1ef7c0535f461ed2565336eed69f6ac2babbe15b"},{"version":"6f618692c560c2032484b73f789cc4d591e3412cadf56f36a3effcc007a9f1c9","signature":"5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51"},{"version":"d6f732b597e4238c26241989600859e24ee24a294586c9536c6ac89be3bfcfd2","signature":"8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21"},{"version":"d176c6e4f4c68955817dc696e3aa55bc3f52753cc410d321ffd9353a2359586b","signature":"c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add"},{"version":"472e325503cfcec80d6ed23ff121080f612558400d18fc69bf62fedc4119d930","signature":"efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac"},{"version":"14b9194f7e782ea4f7bcc1f63e7fc228382f109528615eae5f93ec35fd7c45ab","signature":"3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe"},{"version":"75a97812955173bde7ff29c0981c309c0e3c68c8fb609289606973d3192dea6a","signature":"bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58"},{"version":"615827be9e17301849518c65b22cf55d38fd70752b35ae4bc56f4f1a168856c5","signature":"b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3"},{"version":"d1121f9f0f812490afd777a543b1412ea50ea95da6f5e83f5d8b8617c2ca0ec4","signature":"608c45069e89c4c8f0ab29f896cc93c6553808072d6304b23611b6c6de3c24bb"},{"version":"1db66cc3eb3ef433289a7fcbac5c9bd9bfdde251188cc5886e016b8e60953aa7","signature":"22cbabe752781b5f35482af9d1fcf1455cb1ece74e8b84700d4abcb44abe3776"},{"version":"10051fca57c12434ef48fb3e45136705e09b61de4e7a5f7adfc35f367385f912","signature":"b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1"},{"version":"8bdd4f7af884080d0c18ee346e3ffcc433824d67fde761a71879fea59c8648d3","signature":"a5d1209c7bf277af86281392d46e12ce3dd6052586053f757fb2e606cc75c0f3"},{"version":"ad21d1b3fe8673f3e0dc0e8a592016ca4158a9414471c6d6531aff27713c3e51","signature":"c1f11d9b42bfb0823d34d93c58df91ffb6690b5a717b7d310d83f258f1784e58"},{"version":"b453a055e870914ff0aadc94ebbcedeb5d1e25585f881ac432983f08c4b7d2aa","signature":"d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41"},{"version":"710e8c05b091c0294e0d0df1a734f78fc32293cbf10f51cc91880bc9e0b0a0c6","signature":"775b207f00d4df5b3b0b536aa696d572cdd2cabe8ea18dd28e8b52f691fa2a55"},{"version":"a0e09506f2484d4e384e2a9dca23e7dcd921897b295e5da09b0dec2939524ad3","signature":"f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08"},{"version":"c7c13905a14cf51163e521fba0cc2c62017be95b7ed0e64f7c44e86136b80dc8","signature":"e5a9e27b21ee4961fd8d6a7ff23d361830af7a58097e7afac6cde0258bdaf5ae"},{"version":"913f612848ddd2d0b5aedc12a997e907dbfdc59d1cd622a11e1d82148dd57631","signature":"0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36"},{"version":"f15fc9bd6077dd21863501c7923fae152febccb1db16d4788e33fd1a3e5c2ff9","signature":"e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8"},{"version":"f619bacccdd064647a99e7f781ec966475ce960d6a5a9d78d8f0eee2057d99b8","signature":"5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335"},{"version":"0096c0417f84febf396d181166f8c1d97c2d9aadc864dfba9904f7300ae85705","signature":"92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590"},{"version":"39c4c6d0c2ece1c74188517b655ef41dce04140da60bb60513e30f65a3ceb227","signature":"3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd"},{"version":"14d01e1e345e2722c953982c22572cb07ab093d9b274fcc0de53b909b083d308","signature":"2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed"},{"version":"e4293d5c29b8c2dba0317689cab23a4bbd8c76e3f637d8d1e25805aa02a87043","signature":"c485c6497f7587314c4c4a59b74850cbca4c0c4bc08146a918cfd237ef821dbb"},{"version":"6ef30dfff2b71cf8a0959957c00ff50b66751f5fcf91af940837512028fb5675","signature":"e9eec004735b1bf7015edf5400aeb914a53132134d230e93786590d904d094cc"},{"version":"e539ad450c129a431e31e82517acbf357c95613ff0e20d23ff0a331964cdefa4","signature":"68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d"},{"version":"fb8d6b6816a3f530d7e8f59a01509f14b4c672a381ffcbed29ce2a0c39f6d07d","signature":"56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7"},{"version":"0ef62a227d5e796142ca01e185b99b60529ef08e7ea7b3afed2dd9e0e13028a7","signature":"078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51"},{"version":"a23e9f251ac37df49fa29d2731be383716fba64c0af54b8acbaa31d55fc4dcd9","signature":"f46ba7c6fa7fcc8b3d57c4618c18db3f4d8bfe1fcab5551d7f6d9a82cf4d6078"},"080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d",{"version":"cb971e4549197d366f5764a70e718c8dc65c93c5b8f76312a0d91db657a6ed7c","signature":"874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c"},"6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749",{"version":"977f9752e7185453337e20609747d21846556482c0f1658e29edd182985cafbc","signature":"4e7ac7e5dd58a6c29c724728b031669e3068b194b62c2b83f92e76a36cb34dbb"},{"version":"7194ae36630e7745ebdfb8a33acd43331c6b695e1368cb0fc27477a2e0a44e87","signature":"d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a"},{"version":"6d6cb1dcc82f5f7df5feefa8ffec0ce2995690e5c870c933b9aa4cc140790604","signature":"747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2"},{"version":"45dd87bd3c199e616337ac7f1ca7826c9dea2c43580b807b9918ca2bf03858cf","signature":"b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c"},{"version":"155e91439c11573358dfdd29cf6db5b9fb0ec26af0773c52d77d0c1bd38e7cb7","signature":"e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71"},{"version":"eba7fe6f15dc85d0f14693bc7cc91869bcfa398fb8cce430d094a55beec66762","signature":"b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c"},{"version":"60b1efafbe6dc5a6eac33a5aa4c80e2894f5b5984b174d7bb630801145ed6365","signature":"15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1"},{"version":"b3d915c41553c532571b2b6adf887bc743c4791c3b656d104f04836aa39906d0","signature":"4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183"},{"version":"cf26def8f42aa7645de3b98ded20f1e5da75cf77809b7a5ca4df0fc1eddf6a2b","signature":"73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3"},{"version":"07d27bd68c19c15bcf82a6fd1fc0b4b21c62b251cf71c478895432096e5ce24a","signature":"3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941"},{"version":"bf51306f6124a51ecd19fd14f6f67e63944b92c138c0a51fdc2fc026fc1768ab","signature":"3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1"},{"version":"2d972af17a22a21af0173edd55611f5f397a132104c6cf7067cd6ee953e9499a","signature":"50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e"},{"version":"b33c7ac4fbbb473638b5dcf53f15fd2d5ccdac13f5718d4f1d0f643b5b07b5c2","signature":"3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c"},"72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb",{"version":"b8a6a1a3ecda08d4bcb2342108064184718fb08d54d09186e509da3ea3241b09","signature":"f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf"},{"version":"5e8a906e566ed2daddaf42da1bc3f54432b9f97da14ebd5be28f097369ce9a33","signature":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},{"version":"3d97a5f282bb3fd4669c955c0eb57bd6d47fffe53bc7fff27b235405d7c95068","signature":"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e"},{"version":"78c0f255d6e5581ed186e5fae30cc0ea27760dac79d8d6be8309ca4e81234b1c","signature":"9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c"},{"version":"12f23c9e1c06cb41e66b4b20676aafcf06e018074e1302365a11b84b44e6b034","signature":"aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1"},{"version":"bd9dc889befb6250db377168f2becb95cf85d480710d6b0b862e921915269dce","signature":"150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2"},{"version":"82c5caf9da87baeacfa390572521720578ce4951590a8539482aed97b8c18514","signature":"79576487ac18e047e8192fc582ff488ce375fe4df0cb028a17f831cf42b976f2"},{"version":"ea718b0ce2917cf32bf3f78ae0fccf90fb478e7c75425cc64b4bb1ba2c23f68a","signature":"47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a"},{"version":"87781cc736755404a6c7cbee849566d5afd1131c8c017e9d438e6b47c9ee3fff","signature":"6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47"},{"version":"74948fbd51f0ebdac36a95b604e13f59430d07abc56f772d2398d7cea5b98e64","signature":"afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228"},{"version":"a0802ca154382ebff327d4fe90e5be8cddc57637f49196ab0b5fcc40c467bbcb","signature":"df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494"},{"version":"518d468edb1e58fe5187cd892d3096ae7764a5f6c759303c508a5172a1ec0e62","signature":"db34610570eed46b8b72bc662a91261200b8578af0ac02781ce7d9aca99bc683"},"11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0",{"version":"f904bd507cc8652fb7adf6da46937f45b80c7d47cc08858ae7bfdabd368f4d73","signature":"cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc"},{"version":"c448b3e4d245f40915336a743340dd0837c394e4b55e747abde3217b3e506376","signature":"959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383"},"65d0a893c5b0e0f5ab4e0757e892357dfc7728d01a5918f7c89eb53f4a6b6095",{"version":"67753d9f9797653d8a645a6cc6adfb13014445d3c0bfb164cb17cf8a5a718914","signature":"6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0"},"2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232",{"version":"2ab795906a583472af6cec042e646e1830a41b0024ba78a4ace977b35982aeb1","signature":"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10"},{"version":"abbf31a9c0dcf2d54e279e85ca9f1a4bbf4ee4c56a64c4a727c721c227df942a","signature":"6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3"},{"version":"569d4ba57bfd18f09c0f6c1df0bf527d58e0a38a87611dc7ceecce413f88b501","signature":"abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,294],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,167],[108,154,168],[108,168,169,170,171,172,173],[108,188,197,198,201],[108,188,197,200],[108,188,197,199,201],[108,189,192,193,195],[108,189,190,191],[108,192,193,195,196],[108,189,190,194],[108,200,206],[108,188,197,200,206],[108,197,200,206],[108,197,200,202,203,204,205],[108,188,197,198,199,200,201,206],[108,188,197],[108,154,167,174,175],[108,176],[108,115,154,176,179,180],[108,115,154,167,174,176,179],[108,180],[108,175,176,177,180,181,182,183,184],[108,115,177,179,182],[108,175,182],[108,154,174],[108,154,157],[108,157,158],[108,157,158,159,160],[108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,189],[108,294,295,296,297,298],[108,294,296],[81,108,115,301],[72,108,115],[108,115,304],[108,306],[108,307,308,310],[96,108,115],[107,108,115,317],[81,108,115],[108,144],[108,323,324],[108,321,322,323],[78,81,108,115,314,315,316],[108,302,316,317,328],[108,309],[78,108,115,332],[79,108,115],[108,336],[108,342],[78,81,83,86,96,107,108,115],[108,347],[108,347,349],[108,348],[108,355,360],[108,353,356],[108,353,356,357,358],[108,355],[108,352,359],[108,354],[78,108,110,115,374,375,377],[108,376],[108,391],[108,379,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,382,383,384,385,386,387,388,389,390,391],[108,380,381,382,383,384,385,386,387,388,389,390,391],[108,379,380,381,383,384,385,386,387,388,389,390,391],[108,379,380,381,382,384,385,386,387,388,389,390,391],[108,379,380,381,382,383,385,386,387,388,389,390,391],[108,379,380,381,382,383,384,386,387,388,389,390,391],[108,379,380,381,382,383,384,385,387,388,389,390,391],[108,379,380,381,382,383,384,385,386,388,389,390,391],[108,379,380,381,382,383,384,385,386,387,389,390,391],[108,379,380,381,382,383,384,385,386,387,388,390,391],[108,379,380,381,382,383,384,385,386,387,388,389,391],[108,379,380,381,382,383,384,385,386,387,388,389,390],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,342,401],[108,401,402,403,404,405],[108,338,339,340,341],[108,115,178],[79,108,115,333],[108,411,450],[108,411,435,450],[108,450],[108,411],[108,411,436,450],[108,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449],[108,436,450],[79,96,108,115,313],[79,81,108,115],[79,108,329],[81,108,115,327],[108,327],[108,326],[108,115,462,463,464,465,466,467,468,469,470,471,472],[108,461,462,471],[108,462,471],[108,454,461,462,471],[108,462],[71,108,461,471],[108,461,462,463,464,465,466,467,468,469,470,472],[78,81,83,96,104,107,108,113,115],[108,476],[78,96,108,115],[108,332],[108,330,331],[108,363],[108,362,363],[108,362],[108,362,363,364,366,367,370,371,372,373],[108,363,367],[108,362,363,364,366,367,368,369],[108,362,367],[108,367,371],[108,363,364,365],[108,364],[108,362,363,367],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,156,161,289],[108,154,156,289],[108,154,156,257],[108,154,156,162,257,285,289,290,291],[108,154,156,161,162],[108,154,156],[108,156,163,164,165,166,286,288],[44,50,108,156,166,285],[44,50,108,156,165],[108,154,156,287],[108,155,156],[108,155,156,231],[108,155,156,216,228,233,234],[108,155,156,227,231],[108,155,156,221],[108,155,156,220,222,223],[108,155,156,220,224],[108,156,220,221,222,223,224,225],[108,155,156,228],[108,156,229,230],[108,156,216,217,218,219,226,227,228,231,232,233,234,235,236],[108,155,156,237,238,239],[108,155,156,238],[44,50,108,154,155,156,237,285,289],[108,156],[108,156,272],[108,156,285],[108,156,275,276,277,278,279,280,281,282,283],[108,154,156,208],[108,156,257,281,289],[108,156,208,285,289],[50,108,156,258],[108,156,208,209,258,261,271,272,273,284],[50,108,154,156,240,257],[108,156,285,289],[108,156,207,209],[108,156,209],[108,156,289],[108,156,258],[108,154,156,261],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,270],[108,154,156,263],[108,156,186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[108,154,156,207,208],[108,156,185,271],[108,154,156,209],[50,108,154,156,241,255],[50,108,154,156,255],[50,108,154,156,241,242],[50,108,156,241,242,289],[50,108,156,241,242],[50,108,156,241,242,248,249],[108,156,243,244,245,246,247,248,249,250,251,252,253,254],[50,108,156,241,242,243,244,245,246,247,248,249,250,251,252,253],[50,108,156,241,242,243,247,251,289],[108,156,241,255,256],[50,108,156],[154,162],[154,289],[257],[154,162,257,285,289,290,291],[154,161,162],[154],[44,50,285],[44,50,165],[155],[155,231],[155,216,228,233,234],[155,227,231],[155,221],[155,220,222,223],[155,220,224],[220,221,222,223,224,225],[229,230],[216,217,218,219,226,227,228,231,232,233,234,235,236],[155,156,237,238,239],[50,155,237,289],[272],[285],[154,208],[257,281,289],[208,285,289],[50,258],[208,209,258,261,271,272,273,284],[50,154,240,257],[285,289],[207,209],[209],[289],[258],[154,261],[154,263],[186,187,210,211,212,213,214,215,259,260,262,263,264,265,266,267,268,269,289],[154,207,208],[185,271],[154,209],[50,241,255],[255],[50,241],[50]],"referencedMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,197],[162,198],[291,199],[292,200],[163,201],[164,202],[165,202],[289,203],[286,204],[166,205],[288,206],[155,202],[216,207],[217,207],[218,207],[219,207],[232,207],[233,207],[227,208],[235,209],[236,207],[228,210],[234,207],[220,207],[222,211],[224,212],[225,213],[223,207],[221,207],[226,214],[229,215],[230,207],[231,216],[237,217],[240,218],[239,219],[156,207],[238,220],[208,221],[273,222],[275,202],[276,223],[284,224],[277,202],[278,221],[279,225],[280,202],[282,226],[281,227],[283,228],[274,2],[285,229],[258,230],[186,223],[187,231],[210,232],[211,233],[212,232],[213,221],[214,202],[215,234],[259,235],[260,221],[262,236],[271,237],[264,238],[263,202],[265,202],[266,198],[270,239],[267,234],[268,236],[269,223],[209,240],[272,241],[261,242],[242,243],[256,244],[243,245],[248,246],[244,247],[245,247],[250,248],[246,247],[247,246],[255,249],[249,246],[254,250],[252,251],[253,247],[251,247],[257,252],[241,253]],"exportedModulesMap":[[296,1],[294,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[168,18],[169,19],[170,19],[171,2],[172,19],[174,20],[173,19],[199,21],[201,22],[200,23],[188,2],[196,24],[192,25],[193,25],[197,26],[195,27],[202,28],[203,29],[204,30],[206,31],[205,28],[207,32],[198,33],[176,34],[177,35],[182,36],[180,37],[181,38],[185,39],[183,40],[184,41],[175,42],[158,43],[160,2],[159,44],[161,45],[157,46],[167,13],[51,47],[52,47],[54,48],[55,47],[56,47],[57,49],[58,2],[59,2],[60,2],[53,47],[154,50],[61,51],[143,52],[146,53],[147,2],[148,2],[149,2],[150,2],[151,2],[152,54],[153,55],[191,56],[189,2],[190,2],[194,25],[293,2],[299,57],[295,1],[297,58],[298,1],[300,12],[302,59],[303,60],[305,61],[308,2],[307,62],[311,63],[312,64],[318,65],[301,66],[319,2],[145,67],[320,2],[325,68],[321,2],[324,69],[323,2],[317,70],[329,71],[310,72],[309,2],[333,73],[334,74],[335,64],[306,2],[337,75],[343,76],[344,2],[345,2],[346,77],[304,64],[347,2],[348,78],[350,79],[351,80],[361,81],[353,2],[357,82],[359,83],[358,82],[356,84],[360,85],[355,86],[354,2],[376,87],[377,88],[322,2],[378,2],[392,89],[380,90],[381,91],[379,92],[382,93],[383,94],[384,95],[385,96],[386,97],[387,98],[388,99],[389,100],[390,101],[391,102],[393,75],[313,2],[394,2],[395,2],[144,2],[62,103],[63,103],[65,104],[66,105],[67,106],[68,107],[69,108],[70,109],[71,110],[72,111],[73,112],[74,113],[75,113],[77,114],[76,115],[78,114],[79,116],[80,117],[64,118],[114,2],[81,119],[82,120],[83,121],[115,122],[84,123],[85,124],[86,125],[87,126],[88,127],[89,128],[90,129],[91,130],[92,131],[93,132],[94,132],[95,133],[96,134],[98,135],[97,136],[99,137],[100,138],[101,2],[102,139],[103,140],[104,141],[105,142],[106,143],[107,144],[108,145],[109,146],[110,147],[111,148],[112,149],[113,150],[396,2],[397,2],[398,2],[340,2],[399,2],[316,2],[315,2],[400,76],[402,151],[404,76],[401,76],[403,151],[405,2],[406,152],[338,2],[342,153],[179,154],[178,2],[407,2],[408,2],[409,155],[410,2],[341,2],[435,156],[436,157],[411,158],[414,158],[433,156],[434,156],[424,156],[423,159],[421,156],[416,156],[429,156],[427,156],[431,156],[415,156],[428,156],[432,156],[417,156],[418,156],[430,156],[412,156],[419,156],[420,156],[422,156],[426,156],[437,160],[425,156],[413,156],[450,161],[449,2],[444,160],[446,162],[445,160],[438,160],[439,160],[441,160],[443,160],[447,162],[448,162],[440,162],[442,162],[314,163],[451,164],[452,165],[328,166],[326,167],[327,168],[453,66],[454,2],[455,2],[456,64],[375,2],[336,2],[457,2],[458,2],[459,2],[460,2],[473,169],[472,170],[463,171],[464,172],[465,172],[466,171],[467,171],[468,171],[469,173],[462,174],[470,170],[471,175],[461,2],[474,2],[475,176],[476,2],[477,177],[478,178],[118,2],[352,2],[339,2],[287,2],[330,179],[332,180],[331,179],[364,181],[373,182],[362,2],[363,183],[374,184],[369,185],[370,186],[368,187],[372,188],[366,189],[365,190],[371,191],[367,182],[349,2],[43,2],[50,192],[45,193],[46,194],[47,194],[48,195],[49,195],[44,196],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[290,254],[162,255],[291,256],[292,257],[163,258],[164,259],[165,259],[289,203],[286,260],[166,261],[155,259],[216,262],[217,262],[218,262],[219,262],[232,262],[233,262],[227,263],[235,264],[236,262],[228,265],[234,262],[220,262],[222,266],[224,267],[225,268],[223,262],[221,262],[226,269],[229,262],[230,262],[231,270],[237,271],[240,272],[239,262],[156,262],[238,273],[273,274],[275,259],[276,275],[284,224],[277,259],[279,276],[280,259],[282,277],[281,278],[283,279],[285,280],[258,281],[186,275],[187,282],[210,283],[211,284],[212,283],[214,259],[215,285],[259,286],[262,287],[271,237],[264,288],[263,259],[265,259],[266,255],[270,289],[267,285],[268,287],[269,275],[209,290],[272,291],[261,292],[242,293],[256,294],[243,295],[248,295],[244,295],[245,295],[250,295],[246,295],[247,295],[255,249],[249,295],[254,295],[252,295],[253,295],[251,295],[257,252],[241,296]],"semanticDiagnosticsPerFile":[296,294,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,168,169,170,171,172,174,173,199,201,200,188,196,192,193,197,195,202,203,204,206,205,207,198,176,177,182,180,181,185,183,184,175,158,160,159,161,157,167,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,191,189,190,194,293,299,295,297,298,300,302,303,305,308,307,311,312,318,301,319,145,320,325,321,324,323,317,329,310,309,333,334,335,306,337,343,344,345,346,304,347,348,350,351,361,353,357,359,358,356,360,355,354,376,377,322,378,392,380,381,379,382,383,384,385,386,387,388,389,390,391,393,313,394,395,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,396,397,398,340,399,316,315,400,402,404,401,403,405,406,338,342,179,178,407,408,409,410,341,435,436,411,414,433,434,424,423,421,416,429,427,431,415,428,432,417,418,430,412,419,420,422,426,437,425,413,450,449,444,446,445,438,439,441,443,447,448,440,442,314,451,452,328,326,327,453,454,455,456,375,336,457,458,459,460,473,472,463,464,465,466,467,468,469,462,470,471,461,474,475,476,477,478,118,352,339,287,330,332,331,364,373,362,363,374,369,370,368,372,366,365,371,367,349,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,290,162,291,292,163,164,165,289,286,166,288,155,216,217,218,219,232,233,227,235,236,228,234,220,222,224,225,223,221,226,229,230,231,237,240,239,156,238,208,273,275,276,284,277,278,279,280,282,281,283,274,285,258,186,187,210,211,212,213,214,215,259,260,262,271,264,263,265,266,270,267,268,269,209,272,261,242,256,243,248,244,245,250,246,247,255,249,254,252,253,251,257,241],"latestChangedDtsFile":"./types/index.d.ts"},"version":"4.8.4"} -\ No newline at end of file -diff --git a/dist/types/internals/jsx.d.ts b/dist/types/internals/jsx.d.ts -index 95a075622f84c1a90d0156f4c4fe30e3b3274aed..6bd2d13a1f3796273616630e0adb6b1961c5fdf9 100644 ---- a/dist/types/internals/jsx.d.ts -+++ b/dist/types/internals/jsx.d.ts -@@ -1,5 +1,4 @@ --import type { Infer, Struct } from 'superstruct'; --import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct/dist/utils'; -+import type { AnyStruct, EnumSchema, Infer, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, Struct, UnionToIntersection } from 'superstruct'; - import type { EmptyObject } from '../types'; - /** - * Check if a type is a union. Infers `true` if it is a union, otherwise -diff --git a/dist/types/internals/structs.d.ts b/dist/types/internals/structs.d.ts -index bbfc1289001614aa48dca8aef392f619be8281bb..956456ec616180c31647145a1ecc08efee8fcb2c 100644 ---- a/dist/types/internals/structs.d.ts -+++ b/dist/types/internals/structs.d.ts -@@ -1,6 +1,5 @@ --import type { Infer } from 'superstruct'; -+import type { AnyStruct, Infer, InferStructTuple } from 'superstruct'; - import { Struct } from 'superstruct'; --import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; - import type { EnumToUnion } from './helpers'; - /** - * A wrapper of `superstruct`'s `literal` struct that also defines the name of diff --git a/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch b/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch deleted file mode 100644 index d1d1af1523..0000000000 --- a/.yarn/patches/@metamask-snaps-sdk-npm-6.0.0-c9e758dd8d.patch +++ /dev/null @@ -1,922 +0,0 @@ -diff --git a/dist/index.js.map b/dist/index.js.map -index bc3f309176a232b6b86e5f564ae0b39e155f7682..e70dfadc820a716f322123c11580549fbe515b5f 100644 ---- a/dist/index.js.map -+++ b/dist/index.js.map -@@ -1 +1,125 @@ --{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n","import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { boolean, nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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CAAC;AAAA,EACzE;AAAA,EACA,aAAS,mCAAS,6BAAO,CAAC;AAC5B,CAAC;AAKM,IAAME,iBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtCP;AAAA,EACA;AAAA,EACA;AAAA,EACAH;AAAA,EACAI;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAH;AAAA,EACAI;AAAA,EACAL;AAAA,EACAM;AAAA,EACA;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DR;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;AD7aM,IAAM,kBAAc,4BAAM,CAAC,gBAAY,6BAAO,OAAG,8BAAQ,CAAC,CAAC;AAE3D,IAAM,sBAAkB,iCAAO,6BAAO,OAAG,+BAAS,WAAW,CAAC;AAE9D,IAAM,2BAAuB;AAAA,MAClC,6BAAO;AAAA,MACP,4BAAM,CAAC,qBAAiB,+BAAS,WAAW,CAAC,CAAC;AAChD;AAOO,IAAM,+BAA2B,4BAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;","names":["error","superstructLiteral","superstructUnion","import_superstruct","import_utils","import_utils","import_utils","import_superstruct","import_utils","node","import_superstruct","NodeType","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","import_superstruct","ButtonVariant","ButtonType","import_superstruct","import_superstruct","InputType","import_superstruct","import_superstruct","RowVariant","import_superstruct","import_utils","import_superstruct","SeverityLevel","import_superstruct","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","import_utils","import_superstruct","import_utils","import_superstruct","ButtonStruct","InputStruct","FormStruct","AddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct"]} -\ No newline at end of file -+{ -+ "version": 3, -+ "sources": [ -+ "../src/index.ts", -+ "../src/errors.ts", -+ "../src/internals/error-wrappers.ts", -+ "../src/internals/errors.ts", -+ "../src/internals/structs.ts", -+ "../src/internals/jsx.ts", -+ "../src/internals/svg.ts", -+ "../src/error-wrappers.ts", -+ "../src/images.ts", -+ "../src/ui/components/address.ts", -+ "../src/ui/builder.ts", -+ "../src/ui/nodes.ts", -+ "../src/ui/components/copyable.ts", -+ "../src/ui/components/divider.ts", -+ "../src/ui/components/heading.ts", -+ "../src/ui/components/image.ts", -+ "../src/ui/components/panel.ts", -+ "../src/ui/components/button.ts", -+ "../src/ui/components/form.ts", -+ "../src/ui/components/input.ts", -+ "../src/ui/components/row.ts", -+ "../src/ui/components/text.ts", -+ "../src/ui/components/spinner.ts", -+ "../src/ui/component.ts", -+ "../src/types/handlers/transaction.ts", -+ "../src/types/handlers/user-input.ts", -+ "../src/types/methods/dialog.ts", -+ "../src/types/methods/get-file.ts", -+ "../src/types/methods/manage-state.ts", -+ "../src/types/methods/notify.ts", -+ "../src/types/interface.ts", -+ "../src/jsx/validation.ts" -+ ], -+ "sourcesContent": [ -+ "// Only internals that are used by other Snaps packages should be exported here.\nexport type { EnumToUnion } from './internals';\nexport {\n getErrorData,\n getErrorMessage,\n getErrorStack,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n literal,\n union,\n enumValue,\n} from './internals';\n\n// Re-exported from `@metamask/utils` for convenience.\nexport type {\n Json,\n JsonRpcError,\n JsonRpcRequest,\n JsonRpcParams,\n} from '@metamask/utils';\nexport { assert } from '@metamask/utils';\n\nexport * from './errors';\nexport * from './error-wrappers';\nexport * from './images';\nexport * from './types';\nexport * from './ui';\n", -+ "import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n", -+ "import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n", -+ "import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n", -+ "import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n", -+ "import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n", -+ "import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n", -+ "import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from '@metamask/superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string, unknown } from '@metamask/superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n", -+ "import type { Infer, Struct } from '@metamask/superstruct';\nimport { array, assign, lazy, literal, object, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { array, assign, literal, object, string, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string, optional, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n", -+ "import { assertStruct } from '@metamask/utils';\nimport { is } from '@metamask/superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n", -+ "import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from '@metamask/superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n", -+ "import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n", -+ "import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n", -+ "import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n", -+ "import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n", -+ "import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { boolean, nullable, record, string, union } from '@metamask/superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n", -+ "import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n" -+ ], -+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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A,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,6BAAyB,iCAAO,6BAAO,GAAG,wBAAU;", -+ "names": [ -+ "error", -+ "superstructLiteral", -+ "superstructUnion", -+ "import_superstruct", -+ "import_utils", -+ "import_utils", -+ "import_utils", -+ "import_superstruct", -+ "import_utils", -+ "node", -+ "import_superstruct", -+ "NodeType", -+ "import_superstruct", -+ "import_superstruct", -+ "import_superstruct", -+ "import_superstruct", -+ "import_superstruct", -+ "import_superstruct", -+ "ButtonVariant", -+ "ButtonType", -+ "import_superstruct", -+ "import_superstruct", -+ "InputType", -+ "import_superstruct", -+ "import_superstruct", -+ "RowVariant", -+ "import_superstruct", -+ "import_utils", -+ "import_superstruct", -+ "SeverityLevel", -+ "import_superstruct", -+ "UserInputEventType", -+ "DialogType", -+ "AuxiliaryFileEncoding", -+ "ManageStateOperation", -+ "NotificationType", -+ "import_utils", -+ "import_superstruct", -+ "import_utils", -+ "import_superstruct", -+ "ButtonStruct", -+ "InputStruct", -+ "FormStruct", -+ "AddressStruct", -+ "CopyableStruct", -+ "DividerStruct", -+ "HeadingStruct", -+ "ImageStruct", -+ "TextStruct", -+ "RowStruct", -+ "SpinnerStruct" -+ ] -+} -\ No newline at end of file -diff --git a/dist/index.mjs.map b/dist/index.mjs.map -index d9c617eb5a025482055070d7d000215f44926838..ada98186b6ddd69bce003f4f834ea49ed65d09c5 100644 ---- a/dist/index.mjs.map -+++ b/dist/index.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from 'superstruct';\nimport { assign, object, string, unknown } from 'superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from 'superstruct';\nimport { array, assign, lazy, literal, object, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object, string, optional, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from 'superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from 'superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { boolean, nullable, record, string, union } from 'superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAA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,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9DV;AAAA,EACAE;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACA;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA;AAAA,EACAE;AAAA,EACAC;AAAA,EACAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;AD7aM,IAAM,cAAcG,OAAM,CAAC,YAAYC,SAAO,GAAGC,SAAQ,CAAC,CAAC;AAE3D,IAAM,kBAAkBC,QAAOF,SAAO,GAAGG,UAAS,WAAW,CAAC;AAE9D,IAAM,uBAAuBD;AAAA,EAClCF,SAAO;AAAA,EACPD,OAAM,CAAC,iBAAiBI,UAAS,WAAW,CAAC,CAAC;AAChD;AAOO,IAAM,2BAA2BJ,OAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBG,QAAOF,SAAO,GAAGI,WAAU;","names":["error","assert","assign","literal","object","node","string","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","SeverityLevel","assign","literal","object","optional","string","union","boolean","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","boolean","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","number","object","record","string","string","number","object","record","nullable","array","lazy","boolean","ButtonStruct","optional","InputStruct","FormStruct","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","union","string","boolean","record","nullable","JsonStruct"]} -\ No newline at end of file -+{"version":3,"sources":["../src/errors.ts","../src/internals/error-wrappers.ts","../src/internals/errors.ts","../src/internals/structs.ts","../src/internals/jsx.ts","../src/internals/svg.ts","../src/index.ts","../src/error-wrappers.ts","../src/images.ts","../src/ui/components/address.ts","../src/ui/builder.ts","../src/ui/nodes.ts","../src/ui/components/copyable.ts","../src/ui/components/divider.ts","../src/ui/components/heading.ts","../src/ui/components/image.ts","../src/ui/components/panel.ts","../src/ui/components/button.ts","../src/ui/components/form.ts","../src/ui/components/input.ts","../src/ui/components/row.ts","../src/ui/components/text.ts","../src/ui/components/spinner.ts","../src/ui/component.ts","../src/types/handlers/transaction.ts","../src/types/handlers/user-input.ts","../src/types/methods/dialog.ts","../src/types/methods/get-file.ts","../src/types/methods/manage-state.ts","../src/types/methods/notify.ts","../src/types/interface.ts","../src/jsx/validation.ts"],"sourcesContent":["import type { Json, JsonRpcError } from '@metamask/utils';\n\nimport {\n getErrorCode,\n getErrorData,\n getErrorMessage,\n SNAP_ERROR_CODE,\n SNAP_ERROR_MESSAGE,\n} from './internals';\n\n/**\n * A generic error which can be thrown by a Snap, without it causing the Snap to\n * crash.\n */\nexport class SnapError extends Error {\n readonly #code: number;\n\n readonly #message: string;\n\n readonly #data?: Record;\n\n readonly #stack?: string;\n\n /**\n * Create a new `SnapError`.\n *\n * @param error - The error to create the `SnapError` from. If this is a\n * `string`, it will be used as the error message. If this is an `Error`, its\n * `message` property will be used as the error message. If this is a\n * `JsonRpcError`, its `message` property will be used as the error message\n * and its `code` property will be used as the error code. Otherwise, the\n * error will be converted to a string and used as the error message.\n * @param data - Additional data to include in the error. This will be merged\n * with the error data, if any.\n */\n constructor(\n error: string | Error | JsonRpcError,\n data: Record = {},\n ) {\n const message = getErrorMessage(error);\n super(message);\n\n this.#message = message;\n this.#code = getErrorCode(error);\n\n const mergedData = { ...getErrorData(error), ...data };\n if (Object.keys(mergedData).length > 0) {\n this.#data = mergedData;\n }\n\n this.#stack = super.stack;\n }\n\n /**\n * The error name.\n *\n * @returns The error name.\n */\n get name() {\n return 'SnapError';\n }\n\n /**\n * The error code.\n *\n * @returns The error code.\n */\n get code() {\n return this.#code;\n }\n\n /**\n * The error message.\n *\n * @returns The error message.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get message() {\n return this.#message;\n }\n\n /**\n * Additional data for the error.\n *\n * @returns Additional data for the error.\n */\n get data() {\n return this.#data;\n }\n\n /**\n * The error stack.\n *\n * @returns The error stack.\n */\n // This line is covered, but Jest doesn't pick it up for some reason.\n /* istanbul ignore next */\n get stack() {\n return this.#stack;\n }\n\n /**\n * Convert the error to a JSON object.\n *\n * @returns The JSON object.\n */\n toJSON(): SerializedSnapError {\n return {\n code: SNAP_ERROR_CODE,\n message: SNAP_ERROR_MESSAGE,\n data: {\n cause: {\n code: this.code,\n message: this.message,\n stack: this.stack,\n ...(this.data ? { data: this.data } : {}),\n },\n },\n };\n }\n\n /**\n * Serialize the error to a JSON object. This is called by\n * `@metamask/rpc-errors` when serializing the error.\n *\n * @returns The JSON object.\n */\n serialize() {\n return this.toJSON();\n }\n}\n\n/**\n * A serialized {@link SnapError}. It's JSON-serializable, so it can be sent\n * over the RPC. The original error is wrapped in the `cause` property.\n *\n * @property code - The error code. This is always `-31002`.\n * @property message - The error message. This is always `'Snap Error'`.\n * @property data - The error data.\n * @property data.cause - The cause of the error.\n * @property data.cause.code - The error code.\n * @property data.cause.message - The error message.\n * @property data.cause.stack - The error stack.\n * @property data.cause.data - Additional data for the error.\n * @see SnapError\n */\nexport type SerializedSnapError = {\n code: typeof SNAP_ERROR_CODE;\n message: typeof SNAP_ERROR_MESSAGE;\n data: {\n cause: JsonRpcError;\n };\n};\n","import type { rpcErrors } from '@metamask/rpc-errors';\nimport type { Json } from '@metamask/utils';\n\nimport { SnapError } from '../errors';\n\nexport type JsonRpcErrorFunction = typeof rpcErrors.parse;\n\n/**\n * Create a `SnapError` class from an error function from\n * `@metamask/rpc-errors`. This is useful for creating custom error classes\n * which can be thrown by a Snap.\n *\n * The created class will inherit the message, code, and data properties from\n * the error function.\n *\n * @param fn - The error function to create the class from.\n * @returns The created `SnapError` class.\n */\nexport function createSnapError(fn: JsonRpcErrorFunction) {\n return class SnapJsonRpcError extends SnapError {\n /**\n * Create a new `SnapJsonRpcError` from a message.\n *\n * @param message - The message to create the error from.\n */\n constructor(message?: string);\n\n /**\n * Create a new `SnapJsonRpcError` from data.\n *\n * @param data - The data to create the error from.\n */\n constructor(data?: Record);\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n );\n\n /**\n * Create a new `SnapJsonRpcError` from a message and data.\n *\n * @param message - The message to create the error from.\n * @param data - The data to create the error from.\n */\n constructor(\n message?: string | Record,\n data?: Record,\n ) {\n if (typeof message === 'object') {\n const error = fn();\n super({\n code: error.code,\n message: error.message,\n data: message,\n });\n\n return;\n }\n\n const error = fn(message);\n super({\n code: error.code,\n message: error.message,\n data,\n });\n }\n };\n}\n","import { hasProperty, isObject, isValidJson } from '@metamask/utils';\n\nexport const SNAP_ERROR_CODE = -31002;\nexport const SNAP_ERROR_MESSAGE = 'Snap Error';\n\n/**\n * Get the error message from an unknown error type.\n *\n * - If the error is an object with a `message` property, return the message.\n * - Otherwise, return the error converted to a string.\n *\n * @param error - The error to get the message from.\n * @returns The error message.\n * @internal\n */\nexport function getErrorMessage(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'message') &&\n typeof error.message === 'string'\n ) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Get the error stack from an unknown error type.\n *\n * @param error - The error to get the stack from.\n * @returns The error stack, or undefined if the error does not have a valid\n * stack.\n * @internal\n */\nexport function getErrorStack(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'stack') &&\n typeof error.stack === 'string'\n ) {\n return error.stack;\n }\n\n return undefined;\n}\n\n/**\n * Get the error code from an unknown error type.\n *\n * @param error - The error to get the code from.\n * @returns The error code, or `-32603` if the error does not have a valid code.\n * @internal\n */\nexport function getErrorCode(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'code') &&\n typeof error.code === 'number' &&\n Number.isInteger(error.code)\n ) {\n return error.code;\n }\n\n return -32603;\n}\n\n/**\n * Get the error data from an unknown error type.\n *\n * @param error - The error to get the data from.\n * @returns The error data, or an empty object if the error does not have valid\n * data.\n * @internal\n */\nexport function getErrorData(error: unknown) {\n if (\n isObject(error) &&\n hasProperty(error, 'data') &&\n typeof error.data === 'object' &&\n error.data !== null &&\n isValidJson(error.data) &&\n !Array.isArray(error.data)\n ) {\n return error.data;\n }\n\n return {};\n}\n","import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes(' {\n if (!response.ok) {\n throw new Error(\n `Failed to fetch image data from \"${url}\": ${response.status} ${response.statusText}`,\n );\n }\n\n const blob = await response.blob();\n assert(\n blob.type === 'image/jpeg' || blob.type === 'image/png',\n 'Expected image data to be a JPEG or PNG image.',\n );\n\n return blob;\n });\n}\n\n/**\n * Get image data as data-string from a URL. This is useful for embedding images\n * inside of SVGs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const imageData = await getImageData('https://cataas.com/cat');\n * const svg = `\n * \n * \n * \n * `;\n *\n * // Render the SVG in a Snap UI.\n * const ui = image(svg);\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n * @returns A promise that resolves to the image data as a data-string.\n */\nexport async function getImageData(url: string, options?: RequestInit) {\n const blob = await getRawImageData(url, options);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n\n return `data:${blob.type};base64,${bytesToBase64(bytes)}`;\n}\n\n/**\n * Options for getting an SVG image element from a URL.\n *\n * @property width - The width of the image.\n * @property height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @property request - The options to use when fetching the image data. This is\n * passed directly to `fetch`.\n */\nexport type ImageOptions = {\n width: number;\n height?: number;\n request?: RequestInit;\n};\n\n/**\n * Get an image component from a URL. This is useful for embedding images inside\n * Snap UIs. Only JPEG and PNG images are supported.\n *\n * Note: This function uses `fetch` to get the image data. This means that using\n * it requires the `endowment:network-access` permission.\n *\n * @example\n * const component = await getImage('https://cataas.com/cat');\n *\n * return await snap.request({\n * method: 'snap_dialog',\n * params: {\n * type: 'alert',\n * content: panel([\n * component,\n * ]),\n * },\n * });\n * @param url - The URL to get the image data from.\n * @param options - The options to use when fetching and rendering the image.\n * @param options.width - The width of the image.\n * @param options.height - The height of the image. If this is not provided, the\n * width will be used as the height.\n * @param options.request - The options to use when fetching the image data.\n * This is passed directly to `fetch`.\n * @returns A promise that resolves to the image data as an image component.\n */\nexport async function getImageComponent(\n url: string,\n { width, height = width, request }: ImageOptions,\n) {\n assert(\n typeof width === 'number' && width > 0,\n 'Expected width to be a number greater than 0.',\n );\n\n assert(\n typeof height === 'number' && height > 0,\n 'Expected height to be a number greater than 0.',\n );\n\n const imageData = await getImageData(url, request);\n const size = `width=\"${width}\" height=\"${height}\"`;\n\n return image(\n ``,\n );\n}\n","import { HexChecksumAddressStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n","import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from '@metamask/superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder = Omit<\n Node,\n 'type'\n> extends Record\n ? (...args: []) => Node\n : (...args: [Omit] | NodeArrayType) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder {\n return (...args: [Omit] | NodeArrayType | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string, unknown } from '@metamask/superstruct';\n\n/**\n * The supported node types. This is based on SIP-7.\n *\n * @see https://metamask.github.io/SIPs/SIPS/sip-7\n */\nexport enum NodeType {\n Copyable = 'copyable',\n Divider = 'divider',\n Heading = 'heading',\n Panel = 'panel',\n Spinner = 'spinner',\n // eslint-disable-next-line @typescript-eslint/no-shadow\n Text = 'text',\n Image = 'image',\n Row = 'row',\n Address = 'address',\n Button = 'button',\n Input = 'input',\n Form = 'form',\n}\n\n/**\n * @internal\n */\nexport const NodeStruct = object({\n type: string(),\n});\n\n/**\n * The base node type. All nodes extend this type.\n *\n * @property type - The type of the node. See {@link NodeType} for the supported\n * node types.\n * @internal\n */\nexport type Node = Infer;\n\n/**\n * @internal\n */\nexport const LiteralStruct = assign(\n NodeStruct,\n object({\n value: unknown(),\n }),\n);\n\n/**\n * A node with a value. This is used for nodes that render a value, such as\n * {@link Text}.\n *\n * @property type - The type of the node.\n * @property value - The value of the node. The type of the value depends on the\n * node type.\n * @internal\n */\nexport type Literal = Infer;\n","import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '' });\n * const node = image('');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport { array, assign, lazy, literal, object, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ButtonStruct } from './button';\nimport { CopyableStruct } from './copyable';\nimport { DividerStruct } from './divider';\nimport { FormStruct } from './form';\nimport { HeadingStruct } from './heading';\nimport { ImageStruct } from './image';\nimport { InputStruct } from './input';\nimport { RowStruct } from './row';\nimport { SpinnerStruct } from './spinner';\nimport { TextStruct } from './text';\n\n/**\n * @internal\n */\nexport const ParentStruct = assign(\n NodeStruct,\n object({\n // This node references itself indirectly, so we need to use `lazy()`.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n children: array(lazy(() => ComponentStruct)),\n }),\n);\n\n/**\n * A node which supports child nodes. This is used for nodes that render their\n * children, such as {@link Panel}.\n *\n * @property type - The type of the node.\n * @property children - The children of the node\n * @internal\n */\nexport type Parent = Infer;\n\n/**\n * @internal\n */\nexport const PanelStruct: Struct = assign(\n ParentStruct,\n object({\n type: literal(NodeType.Panel),\n }),\n);\n\n/**\n * A panel node, which renders its children.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\n// This node references itself indirectly, so it cannot be inferred.\nexport type Panel = {\n type: NodeType.Panel;\n children: Component[];\n};\n\n/**\n * Create a {@link Panel} node.\n *\n * @param args - The node arguments. This can be either an array of children, or\n * an object with a `children` property.\n * @param args.children - The child nodes of the panel. This can be any valid\n * {@link Component}.\n * @returns The panel node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = panel({\n * children: [\n * heading({ text: 'Hello, world!' }),\n * text({ text: 'This is a panel.' }),\n * ],\n * });\n *\n * const node = panel([\n * heading('Hello, world!'),\n * text('This is a panel.'),\n * ]);\n */\nexport const panel = createBuilder(NodeType.Panel, PanelStruct, ['children']);\n\n// This is defined separately from `Component` to avoid circular dependencies.\nexport const ComponentStruct = union([\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n PanelStruct,\n SpinnerStruct,\n TextStruct,\n RowStruct,\n AddressStruct,\n InputStruct,\n FormStruct,\n ButtonStruct,\n]);\n\n/**\n * All supported component types.\n */\nexport type Component = Infer;\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { array, assign, literal, object, string, union } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/develop/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n /* eslint-disable @typescript-eslint/no-shadow */\n Text = 'text',\n Number = 'number',\n /* eslint-enable @typescript-eslint/no-shadow */\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string, optional, union } from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n","import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n","import { assertStruct } from '@metamask/utils';\nimport { is } from '@metamask/superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\nimport type { ChainId } from '../caip';\n\n/**\n * The severity level of content being returned from a transaction insight.\n * Currently only one level is supported:\n *\n * - `critical` - The transaction is critical and should not be submitted by the\n * user.\n */\nexport enum SeverityLevel {\n Critical = 'critical',\n}\n\n/**\n * An EIP-1559 (type 2) transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property maxFeePerGas - The maximum fee per gas of the transaction.\n * @property maxPriorityFeePerGas - The maximum priority fee per gas of the\n * transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n * @see https://eips.ethereum.org/EIPS/eip-1559\n */\nexport type EIP1559Transaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A legacy (type \"0\") transaction object.\n *\n * @property from - The address the transaction is being sent from.\n * @property to - The address the transaction is being sent to.\n * @property nonce - The nonce of the transaction.\n * @property value - The value of the transaction.\n * @property data - The data of the transaction.\n * @property gas - The gas limit of the transaction.\n * @property gasPrice - The gas price of the transaction.\n * @property estimateSuggested - The suggested gas price for the transaction.\n * @property estimateUsed - The gas price used for the transaction.\n */\nexport type LegacyTransaction = {\n from: string;\n to: string;\n nonce: string;\n value: string;\n data: string;\n gas: string;\n gasPrice: string;\n estimateSuggested: string;\n estimateUsed: string;\n};\n\n/**\n * A transaction object. This can be either an EIP-1559 transaction or a legacy\n * transaction.\n *\n * @see EIP1559Transaction\n * @see LegacyTransaction\n */\nexport type Transaction = EIP1559Transaction | LegacyTransaction;\n\n/**\n * The `onTransaction` handler. This is called whenever a transaction is\n * submitted to the snap. It can return insights about the transaction, which\n * will be displayed to the user.\n *\n * Note that using this handler requires the `endowment:transaction-insights`\n * permission.\n *\n * @param args - The request arguments.\n * @param args.transaction - The transaction object, containing the address,\n * value, data, and other properties of the transaction.\n * @param args.chainId - The CAIP-2 {@link ChainId} of the network the\n * transaction is being submitted to.\n * @param args.transactionOrigin - The origin of the transaction. This is the\n * URL of the website that submitted the transaction. This is only available if\n * the Snap has enabled the `allowTransactionOrigin` option in the\n * `endowment:transaction-insight` permission.\n * @returns An object containing insights about the transaction. See\n * {@link OnTransactionResponse}. Can also return `null` if no insights are\n * available.\n */\nexport type OnTransactionHandler = (args: {\n transaction: Transaction;\n chainId: ChainId;\n transactionOrigin?: string;\n}) => Promise;\n\n/**\n * The response from a Snap's `onTransaction` handler.\n *\n * @property component - A custom UI component, that will be shown in MetaMask.\n * @property id - A Snap interface ID.\n * @property severity - The severity level of the content. Currently only one\n * level is supported: `critical`.\n */\nexport type OnTransactionResponse =\n | {\n content: ComponentOrElement;\n severity?: EnumToUnion;\n }\n | {\n id: string;\n severity?: EnumToUnion;\n };\n","import type { Infer } from '@metamask/superstruct';\nimport {\n number,\n assign,\n literal,\n nullable,\n object,\n optional,\n record,\n string,\n union,\n boolean,\n} from '@metamask/superstruct';\n\nimport type { InterfaceContext } from '../interface';\n\n/**\n * The type of user input event fired.\n * Currently only three events are supported:\n *\n * - `ButtonClickEvent` - A button has been clicked in the UI.\n * - `FormSubmitEvent` - A Form has been submitted in the UI.\n * - `InputChangeEvent` - The value of an input field has changed in the UI.\n * - `FileUploadEvent` - A file has been uploaded in the UI.\n */\nexport enum UserInputEventType {\n ButtonClickEvent = 'ButtonClickEvent',\n FormSubmitEvent = 'FormSubmitEvent',\n InputChangeEvent = 'InputChangeEvent',\n FileUploadEvent = 'FileUploadEvent',\n}\n\nexport const GenericEventStruct = object({\n type: string(),\n name: optional(string()),\n});\n\nexport const ButtonClickEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.ButtonClickEvent),\n name: optional(string()),\n }),\n);\n\n/**\n * A button click event fired in the UI. This is passed to the params of the\n * `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for\n * the different types. This is always `ButtonClickEvent`.\n * @property name - The optional component name that fired the event.\n */\nexport type ButtonClickEvent = Infer;\n\nexport const FileStruct = object({\n name: string(),\n size: number(),\n contentType: string(),\n contents: string(),\n});\n\n/**\n * A file object containing the file name, size, content type, and the base64\n * encoded contents of the file.\n *\n * @property name - The name of the file.\n * @property size - The size of the file in bytes.\n * @property contentType - The content type of the file.\n * @property contents - The base64 encoded contents of the file.\n */\nexport type File = Infer;\n\nexport const FormSubmitEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FormSubmitEvent),\n value: record(string(), nullable(union([string(), FileStruct, boolean()]))),\n name: string(),\n }),\n);\n\n/**\n * A form submit event, which is fired when a submit button is clicked.\n *\n * @property type - The type of event fired. This is always `FormSubmitEvent`.\n * @property name - The name of the form that was submitted.\n * @property value - The form values submitted as an object. The keys are the\n * names of the form fields and the values are the values of the form fields. If\n * a form field is empty, the value is `null` or an empty string.\n * @property files - The files uploaded in the form. The keys are the names of\n * the file input fields and the values are the file objects containing the file\n * name, size, content type, and the base64 encoded contents of the file. See\n * {@link File}.\n */\nexport type FormSubmitEvent = Infer;\n\nexport const InputChangeEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.InputChangeEvent),\n name: string(),\n value: union([string(), boolean()]),\n }),\n);\n\n/**\n * An input change event, which is fired when the value of an input field\n * changes.\n *\n * @property type - The type of event fired. This is always `InputChangeEvent`.\n * @property name - The name of the input field that changed.\n * @property value - The new value of the input field.\n */\nexport type InputChangeEvent = Infer;\n\nexport const FileUploadEventStruct = assign(\n GenericEventStruct,\n object({\n type: literal(UserInputEventType.FileUploadEvent),\n name: string(),\n file: nullable(FileStruct),\n }),\n);\n\n/**\n * A file upload event, which is fired when a file is uploaded.\n *\n * @property type - The type of event fired. This is always `FileUploadEvent`.\n * @property name - The name of the file input field that was used to upload the\n * file.\n * @property file - The file object containing the file name, size,\n * content type, and the base64 encoded contents of the file.\n * @see File\n */\nexport type FileUploadEvent = Infer;\n\nexport const UserInputEventStruct = union([\n ButtonClickEventStruct,\n FormSubmitEventStruct,\n InputChangeEventStruct,\n FileUploadEventStruct,\n]);\n\n/**\n * A user input event fired in the UI. This is passed to the params of the `onUserInput` handler.\n *\n * @property type - The type of event fired. See {@link UserInputEventType} for the different types.\n * @property name - The component name that fired the event. It is optional for\n * an {@link UserInputEventType.ButtonClickEvent}.\n * @property value - The value associated with the event. Only available when an\n * {@link UserInputEventType.FormSubmitEvent} is fired. It contains the form values submitted.\n */\nexport type UserInputEvent =\n | ButtonClickEvent\n | FormSubmitEvent\n | InputChangeEvent\n | FileUploadEvent;\n\n/**\n * The `onUserInput` handler. This is called when an user input event is fired in the UI.\n *\n * @param args - The user input event.\n * @param args.id - The user interface id.\n * @param args.event - The {@link UserInputEvent} object, containing the data about the fired event.\n */\nexport type OnUserInputHandler = (args: {\n id: string;\n event: UserInputEvent;\n context: InterfaceContext | null;\n}) => Promise;\n","import type { ComponentOrElement } from '..';\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The type of dialog to display.\n *\n * - `alert` - A dialog with a single button.\n * - `confirmation` - A dialog with two buttons, one to confirm and one to\n * cancel.\n * - `prompt` - A dialog with two buttons and a text input.\n */\nexport enum DialogType {\n Alert = 'alert',\n Confirmation = 'confirmation',\n Prompt = 'prompt',\n}\n\n/**\n * An alert dialog.\n *\n * @property type - The type of dialog. Must be `alert`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type AlertDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A confirmation dialog.\n *\n * @property type - The type of dialog. Must be `confirmation`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n */\nexport type ConfirmationDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n }\n | {\n type: EnumToUnion;\n id: string;\n };\n\n/**\n * A prompt dialog.\n *\n * @property type - The type of dialog. Must be `prompt`.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - An optional placeholder text to display in the text\n * input.\n */\nexport type PromptDialog =\n | {\n type: EnumToUnion;\n content: ComponentOrElement;\n placeholder?: string;\n }\n | {\n type: EnumToUnion;\n id: string;\n placeholder?: string;\n };\n\n/**\n * The request parameters for the `snap_dialog` method.\n *\n * @property type - The type of dialog to display.\n * @property content - The content to display in the dialog.\n * @property id - The Snap interface ID.\n * @property placeholder - The placeholder text to display in the dialog. Only\n * applicable for the `prompt` dialog.\n */\nexport type DialogParams = AlertDialog | ConfirmationDialog | PromptDialog;\n\n/**\n * The result returned by the `snap_dialog` method.\n *\n * - If the dialog is an `alert`, the result is `null`.\n * - If the dialog is a `confirmation`, the result is a boolean indicating\n * whether the user confirmed the dialog.\n * - If the dialog is a `prompt`, the result is the value entered by\n * the user.\n */\nexport type DialogResult = null | boolean | string;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The encoding to use when retrieving the file. Defaults to `Base64`.\n */\nexport enum AuxiliaryFileEncoding {\n Base64 = 'base64',\n Hex = 'hex',\n Utf8 = 'utf8',\n}\n\n/**\n * The request parameters for the `snap_getFile` method.\n *\n * @property path - The path to the file to retrieve.\n * @property encoding - The encoding to use when retrieving the file.\n */\nexport type GetFileParams = {\n path: string;\n encoding?: EnumToUnion;\n};\n\n/**\n * The result returned by the `snap_getFile` method.\n */\nexport type GetFileResult = string;\n","import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion;\n encrypted?: boolean;\n newState: Record;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record | null;\n","import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n","import { JsonStruct } from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { boolean, nullable, record, string, union } from '@metamask/superstruct';\n\nimport type { JSXElement } from '../jsx';\nimport { RootJSXElementStruct } from '../jsx';\nimport type { Component } from '../ui';\nimport { ComponentStruct } from '../ui';\nimport { FileStruct } from './handlers';\n\n/**\n * To avoid typing problems with the interface state when manipulating it we\n * have to differentiate the state of a form (that will be contained inside the\n * root state) and the root state since a key in the root stat can contain\n * either the value of an input or a sub-state of a form.\n */\n\nexport const StateStruct = union([FileStruct, string(), boolean()]);\n\nexport const FormStateStruct = record(string(), nullable(StateStruct));\n\nexport const InterfaceStateStruct = record(\n string(),\n union([FormStateStruct, nullable(StateStruct)]),\n);\n\nexport type State = Infer;\nexport type FormState = Infer;\nexport type InterfaceState = Infer;\n\nexport type ComponentOrElement = Component | JSXElement;\nexport const ComponentOrElementStruct = union([\n ComponentStruct,\n RootJSXElementStruct,\n]);\n\nexport const InterfaceContextStruct = record(string(), JsonStruct);\nexport type InterfaceContext = Infer;\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAcO,IAAM,YAAN,cAAwB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBnC,YACE,OACA,OAA6B,CAAC,GAC9B;AACA,UAAM,UAAU,gBAAgB,KAAK;AACrC,UAAM,OAAO;AAzBf,uBAAS,OAAT;AAEA,uBAAS,UAAT;AAEA,uBAAS,OAAT;AAEA,uBAAS,QAAT;AAqBE,uBAAK,UAAW;AAChB,uBAAK,OAAQ,aAAa,KAAK;AAE/B,UAAM,aAAa,EAAE,GAAG,aAAa,KAAK,GAAG,GAAG,KAAK;AACrD,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,yBAAK,OAAQ;AAAA,IACf;AAEA,uBAAK,QAAS,MAAM;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAI,UAAU;AACZ,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,OAAO;AACT,WAAO,mBAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyBG,QAAOF,SAAO,GAAGI,WAAU;","names":["error","assert","assign","literal","object","node","string","NodeType","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","assign","literal","object","string","assign","object","literal","string","assign","literal","object","assign","object","literal","array","assign","literal","object","union","assign","literal","object","optional","string","union","ButtonVariant","ButtonType","assign","object","literal","string","optional","union","assign","literal","object","string","union","assign","literal","object","optional","string","union","InputType","assign","object","literal","optional","string","union","union","assign","object","literal","string","assign","literal","object","string","optional","union","assign","boolean","literal","object","optional","string","assign","object","literal","string","optional","boolean","RowVariant","union","assign","object","literal","optional","string","assign","literal","object","assign","object","literal","assign","object","array","literal","union","assertStruct","assertStruct","SeverityLevel","assign","literal","object","optional","string","union","boolean","UserInputEventType","DialogType","AuxiliaryFileEncoding","ManageStateOperation","NotificationType","JsonStruct","boolean","nullable","record","string","union","hasProperty","HexChecksumAddressStruct","isPlainObject","is","boolean","optional","array","lazy","nullable","number","object","record","string","string","number","object","record","nullable","array","lazy","boolean","ButtonStruct","optional","InputStruct","FormStruct","AddressStruct","HexChecksumAddressStruct","CopyableStruct","DividerStruct","HeadingStruct","ImageStruct","TextStruct","RowStruct","SpinnerStruct","union","string","boolean","record","nullable","JsonStruct"]} -\ No newline at end of file -diff --git a/dist/jsx/index.js.map b/dist/jsx/index.js.map -index 9fda623ee0a5d0737fc1aa95e1479c8d83068206..be2ef2f3fe8a8e82844815880acb22a37f21867f 100644 ---- a/dist/jsx/index.js.map -+++ b/dist/jsx/index.js.map -@@ -1 +1,96 @@ --{"version":3,"sources":["../../src/jsx/index.ts","../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Checkbox.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/FileInput.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/components/Tooltip.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n","import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoFA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;ACrFA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAeN,IAAM,WAAW,oBAAgDA,KAAI;;;ACf5E,IAAMC,QAAO;AAkBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACpB5E,IAAMC,QAA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,SAC1B,0BAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","import_superstruct","superstructLiteral","superstructUnion","import_superstruct","element"]} -\ No newline at end of file -+{ -+ "version": 3, -+ "sources": [ -+ "../../src/jsx/index.ts", -+ "../../src/jsx/component.ts", -+ "../../src/jsx/components/form/Button.ts", -+ "../../src/jsx/components/form/Checkbox.ts", -+ "../../src/jsx/components/form/Dropdown.ts", -+ "../../src/jsx/components/form/Option.ts", -+ "../../src/jsx/components/form/Field.ts", -+ "../../src/jsx/components/form/FileInput.ts", -+ "../../src/jsx/components/form/Form.ts", -+ "../../src/jsx/components/form/Input.ts", -+ "../../src/jsx/components/formatting/Bold.ts", -+ "../../src/jsx/components/formatting/Italic.ts", -+ "../../src/jsx/components/Address.ts", -+ "../../src/jsx/components/Box.ts", -+ "../../src/jsx/components/Copyable.ts", -+ "../../src/jsx/components/Divider.ts", -+ "../../src/jsx/components/Value.ts", -+ "../../src/jsx/components/Heading.ts", -+ "../../src/jsx/components/Image.ts", -+ "../../src/jsx/components/Link.ts", -+ "../../src/jsx/components/Row.ts", -+ "../../src/jsx/components/Spinner.ts", -+ "../../src/jsx/components/Text.ts", -+ "../../src/jsx/components/Tooltip.ts", -+ "../../src/jsx/jsx-runtime.ts", -+ "../../src/jsx/validation.ts", -+ "../../src/internals/structs.ts", -+ "../../src/internals/jsx.ts", -+ "../../src/internals/svg.ts", -+ "../../src/jsx/jsx-dev-runtime.ts" -+ ], -+ "sourcesContent": [ -+ "export * from './component';\nexport * from './components';\nexport * from './jsx-runtime';\nexport * from './jsx-dev-runtime';\nexport {\n JSXElementStruct,\n RootJSXElementStruct,\n isJSXElement,\n isJSXElementUnsafe,\n assertJSXElement,\n} from './validation';\n", -+ "import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n", -+ "import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n", -+ "import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n", -+ "import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n", -+ "import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n", -+ "import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n", -+ "import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n", -+ "import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n", -+ "import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n", -+ "import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n", -+ "import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n", -+ "import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n", -+ "import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n", -+ "import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n", -+ "import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n", -+ "import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n", -+ "import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n", -+ "import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n", -+ "import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n", -+ "import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n" -+ ], -+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACoFA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;ACrFA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAeN,IAAM,WAAW,oBAAgDA,KAAI;;;ACf5E,IAAMC,QAAO;AAkBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACpB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACTxE,IAAMC,QAAO;AAqBN,IAAM,QAAQ,oBAA6CA,KAAI;;;AC3BtE,IAAMC,QAAO;AA0BN,IAAM,YAAY,oBAAiDA,KAAI;;;AC5B9E,IAAM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C;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;", -+ "names": [ -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "TYPE", -+ "import_superstruct", -+ "superstructLiteral", -+ "superstructUnion", -+ "import_superstruct", -+ "element" -+ ] -+} -\ No newline at end of file -diff --git a/dist/jsx/index.mjs.map b/dist/jsx/index.mjs.map -index f20039d01fa7d6a3299c584bdbb5dea4a7015b1c..59b66e001ec9c9d35d61842f2b6108e7671cf3b4 100644 ---- a/dist/jsx/index.mjs.map -+++ b/dist/jsx/index.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Checkbox.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/FileInput.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/components/Tooltip.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n","import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAoFA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IAC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AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB;AAK7B,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AAaO,SAAS,mBAAmB,OAAqC;AACtE,SACE,cAAc,KAAK,KACnB,YAAY,OAAO,MAAM,KACzB,YAAY,OAAO,OAAO,KAC1B,YAAY,OAAO,KAAK;AAE5B;AAQO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","string","string","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/component.ts","../../src/jsx/components/form/Button.ts","../../src/jsx/components/form/Checkbox.ts","../../src/jsx/components/form/Dropdown.ts","../../src/jsx/components/form/Option.ts","../../src/jsx/components/form/Field.ts","../../src/jsx/components/form/FileInput.ts","../../src/jsx/components/form/Form.ts","../../src/jsx/components/form/Input.ts","../../src/jsx/components/formatting/Bold.ts","../../src/jsx/components/formatting/Italic.ts","../../src/jsx/components/Address.ts","../../src/jsx/components/Box.ts","../../src/jsx/components/Copyable.ts","../../src/jsx/components/Divider.ts","../../src/jsx/components/Value.ts","../../src/jsx/components/Heading.ts","../../src/jsx/components/Image.ts","../../src/jsx/components/Link.ts","../../src/jsx/components/Row.ts","../../src/jsx/components/Spinner.ts","../../src/jsx/components/Text.ts","../../src/jsx/components/Tooltip.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable = Type | Nestable[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren = Nestable;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record,\n Type extends string = string,\n>(type: Type): SnapComponent {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import type { StringElement } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add the `onClick` prop to the `ButtonProps` type.\n\n/**\n * The props of the {@link Button} component.\n *\n * @property children - The text to display on the button.\n * @property name - The name of the button. This is used to identify the button\n * in the event handler.\n * @property type - The type of the button, i.e., `'button'` or `'submit'`.\n * Defaults to `'button'`.\n * @property variant - The variant of the button, i.e., `'primary'` or\n * `'destructive'`. Defaults to `'primary'`.\n * @property disabled - Whether the button is disabled. Defaults to `false`.\n */\nexport type ButtonProps = {\n children: StringElement;\n name?: string | undefined;\n type?: 'button' | 'submit' | undefined;\n variant?: 'primary' | 'destructive' | undefined;\n disabled?: boolean | undefined;\n};\n\nconst TYPE = 'Button';\n\n/**\n * A button component, which is used to create a clickable button.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display on the button. This should be a\n * string or an array of strings.\n * @returns A button element.\n * @example\n * \n */\nexport const Button = createSnapComponent(TYPE);\n\n/**\n * A button element.\n *\n * @see Button\n */\nexport type ButtonElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link Checkbox} component.\n *\n * @property name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @property checked - Whether the checkbox is checked or not.\n * @property label - An optional label for the checkbox.\n * @property variant - An optional variant for the checkbox.\n */\nexport type CheckboxProps = {\n name: string;\n checked?: boolean | undefined;\n label?: string | undefined;\n variant?: 'default' | 'toggle' | undefined;\n};\n\nconst TYPE = 'Checkbox';\n\n/**\n * A checkbox component, which is used to create a checkbox.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the checkbox. This is used to identify the\n * state in the form data.\n * @param props.checked - Whether the checkbox is checked or not.\n * @param props.label - An optional label for the checkbox.\n * @param props.variant - An optional variant for the checkbox.\n * @returns A checkbox element.\n * @example\n * \n */\nexport const Checkbox = createSnapComponent(TYPE);\n\n/**\n * A checkbox element.\n *\n * @see Checkbox\n */\nexport type CheckboxElement = ReturnType;\n","import type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\nimport type { OptionElement } from './Option';\n\n/**\n * The props of the {@link Dropdown} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The selected value of the dropdown.\n * @property children - The children of the dropdown.\n */\nexport type DropdownProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren;\n};\n\nconst TYPE = 'Dropdown';\n\n/**\n * A dropdown component, which is used to create a dropdown.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the dropdown field. This is used to identify the\n * state in the form data.\n * @param props.value - The selected value of the dropdown.\n * @param props.children - The children of the dropdown.\n * @returns A dropdown element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Dropdown = createSnapComponent(TYPE);\n\n/**\n * A dropdown element.\n *\n * @see Dropdown\n */\nexport type DropdownElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Dropdown } from './Dropdown';\n\n/**\n * The props of the {@link Option} component.\n *\n * @property value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @property children - The text to display.\n */\ntype OptionProps = {\n value: string;\n children: string;\n};\n\nconst TYPE = 'Option';\n\n/**\n * A dropdown option component, which is used to create a dropdown option. This component\n * can only be used as a child of the {@link Dropdown} component.\n *\n * @param props - The props of the component.\n * @param props.value - The value of the dropdown option. This is used to populate the\n * state in the form data.\n * @param props.children - The text to display.\n * @returns A dropdown option element.\n * @example\n * \n * \n * \n * \n * \n */\nexport const Option = createSnapComponent(TYPE);\n\n/**\n * A dropdown option element.\n *\n * @see Option\n */\nexport type OptionElement = ReturnType;\n","import { createSnapComponent } from '../../component';\nimport type { ButtonElement } from './Button';\nimport type { CheckboxElement } from './Checkbox';\nimport type { DropdownElement } from './Dropdown';\nimport type { FileInputElement } from './FileInput';\nimport type { InputElement } from './Input';\n\n/**\n * The props of the {@link Field} component.\n *\n * @property label - The label of the field.\n * @property error - The error message of the field.\n * @property children - The input field and the submit button.\n */\nexport type FieldProps = {\n label?: string | undefined;\n error?: string | undefined;\n children:\n | [InputElement, ButtonElement]\n | DropdownElement\n | FileInputElement\n | InputElement\n | CheckboxElement;\n};\n\nconst TYPE = 'Field';\n\n/**\n * A field component, which is used to create a form field. This component can\n * only be used as a child of the {@link Form} component.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the field.\n * @param props.error - The error message of the field.\n * @param props.children - The input field and the submit button.\n * @returns A field element.\n * @example\n * \n * \n * \n * \n * @example\n * \n * \n * \n */\nexport const Field = createSnapComponent(TYPE);\n\n/**\n * A field element.\n *\n * @see Field\n */\nexport type FieldElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n/**\n * The props of the {@link FileInput} component.\n *\n * @property name - The name of the file input field. This is used to identify\n * the file input field in the form data.\n * @property label - The label of the file input field.\n * @property accept - The file types that the file input field accepts. If not\n * specified, the file input field accepts all file types.\n * @property compact - Whether the file input field is compact. Default is\n * `false`.\n */\nexport type FileInputProps = {\n name: string;\n accept?: string[] | undefined;\n compact?: boolean | undefined;\n};\n\nconst TYPE = 'FileInput';\n\n/**\n * A file input component, which is used to create a file input field. This\n * component can only be used as a child of the {@link Field} component.\n *\n * The total size of the files that can be uploaded may not exceed 64 MB.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the file input field. This is used to\n * identify the file input field in the form data.\n * @param props.accept - The file types that the file input field accepts. If\n * not specified, the file input field accepts all file types. For examples of\n * valid values, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).\n * @param props.compact - Whether the file input field is compact. Default is\n * `false`.\n * @returns A file input element.\n * @example\n * \n * @example\n * \n * @example\n * \n * \n * \n */\nexport const FileInput = createSnapComponent(TYPE);\n\n/**\n * A file input element.\n *\n * @see FileInput\n */\nexport type FileInputElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n// TODO: Add `onSubmit` prop to the `FormProps` type.\n\n/**\n * The props of the {@link Form} component.\n *\n * @property children - The children of the form.\n * @property name - The name of the form. This is used to identify the form in\n * the event handler.\n */\nexport type FormProps = {\n children: SnapsChildren;\n name: string;\n};\n\nconst TYPE = 'Form';\n\n/**\n * A form component, which is used to create a form.\n *\n * @param props - The props of the component.\n * @param props.children - The form fields. This should be a single field or an\n * array of fields.\n * @param props.name - The name of the form. This is used to identify the form\n * in the event handler.\n * @returns A form element.\n * @example\n *
\n * \n * \n * \n * \n *
\n */\nexport const Form = createSnapComponent(TYPE);\n\n/**\n * A form element.\n *\n * @see Form\n */\nexport type FormElement = ReturnType;\n","import { createSnapComponent } from '../../component';\n\n// TODO: Add the `onChange` prop to the `InputProps` type.\n\n/**\n * The props of the {@link Input} component.\n *\n * @property name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @property type - The type of the input field. Defaults to `text`.\n * @property value - The value of the input field.\n * @property placeholder - The placeholder text of the input field.\n */\nexport type InputProps = {\n name: string;\n type?: 'text' | 'password' | 'number' | undefined;\n value?: string | undefined;\n placeholder?: string | undefined;\n};\n\nconst TYPE = 'Input';\n\n/**\n * An input component, which is used to create an input field.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field. This is used to identify the\n * input field in the form data.\n * @param props.type - The type of the input field.\n * @param props.value - The value of the input field.\n * @param props.placeholder - The placeholder text of the input field.\n * @returns An input element.\n * @example\n * \n */\nexport const Input = createSnapComponent(TYPE);\n\n/**\n * An input element.\n *\n * @see Input\n */\nexport type InputElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Text } from '../Text';\n\n/**\n * The children of the {@link Bold} component.\n */\nexport type BoldChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Bold} component.\n *\n * @property children - The text to display in bold.\n */\nexport type BoldProps = {\n children: BoldChildren;\n};\n\nconst TYPE = 'Bold';\n\n/**\n * A bold component, which is used to display text in bold. This component can\n * only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in bold.\n * @returns A bold element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Bold = createSnapComponent(TYPE);\n\n/**\n * A bold element.\n *\n * @see Bold\n */\nexport type BoldElement = ReturnType;\n","import type { JsonObject, SnapElement, SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\n/**\n * The children of the {@link Italic} component.\n */\nexport type ItalicChildren = SnapsChildren<\n | string\n // We have to specify the type here to avoid a circular reference.\n | SnapElement\n>;\n\n/**\n * The props of the {@link Italic} component.\n *\n * @property children - The text to display in italic. This should be a string\n * or an array of strings.\n */\nexport type ItalicProps = {\n children: ItalicChildren;\n};\n\nconst TYPE = 'Italic';\n\n/**\n * An italic component, which is used to display text in italic. This componen\n * can only be used as a child of the {@link Text} component.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in italic. This should be a\n * string or an array of strings.\n * @returns An italic element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Italic = createSnapComponent(TYPE);\n\n/**\n * An italic element.\n *\n * @see Italic\n */\nexport type ItalicElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Address} component.\n *\n * @property address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n */\nexport type AddressProps = {\n address: `0x${string}`;\n};\n\nconst TYPE = 'Address';\n\n/**\n * An address component, which is used to display an Ethereum address.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.address - The (Ethereum) address to display. This should be a\n * valid Ethereum address, starting with `0x`.\n * @returns An address element.\n * @example\n *
\n */\nexport const Address = createSnapComponent(TYPE);\n\n/**\n * An address element.\n *\n * @see Address\n */\nexport type AddressElement = ReturnType;\n","import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * \n * Hello world!\n * \n */\nexport const Box = createSnapComponent(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Copyable} component.\n *\n * @property value - The value to copy when the user clicks on the copyable\n * element.\n * @property sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n */\nexport type CopyableProps = {\n value: string;\n sensitive?: boolean | undefined;\n};\n\nconst TYPE = 'Copyable';\n\n/**\n * A copyable component, which is used to display text that can be copied by the\n * user.\n *\n * @param props - The props of the component.\n * @param props.value - The value to copy when the user clicks on the copyable\n * element.\n * @param props.sensitive - Whether the value is sensitive. If `true`, the value\n * will be hidden when the user is not interacting with the copyable element.\n * @example\n * \n * \n */\nexport const Copyable = createSnapComponent(TYPE);\n\n/**\n * A copyable element.\n *\n * @see Copyable\n */\nexport type CopyableElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Divider';\n\n/**\n * A divider component, which is used to create a horizontal line between\n * elements.\n *\n * This component does not have any props.\n *\n * @returns A divider element.\n * @example\n * \n */\nexport const Divider = createSnapComponent(TYPE);\n\n/**\n * A divider element.\n *\n * @see Divider\n */\nexport type DividerElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Value} component.\n *\n * @property value - The value shown on the right side.\n * @property extra - The extra text shown on the left side.\n */\nexport type ValueProps = {\n value: string;\n extra: string;\n};\n\nconst TYPE = 'Value';\n\n/**\n * A value component, which can be used to display two different text values side by side.\n *\n * This component can only be used as a child of the {@link Row} component.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.value - The value shown on the right side.\n * @param props.extra - The extra text shown on the left side.\n * @returns A value element.\n * @example\n * \n */\nexport const Value = createSnapComponent(TYPE);\n\n/**\n * A value element.\n *\n * @see Value\n */\nexport type ValueElement = ReturnType;\n","import type { StringElement } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Heading} component.\n *\n * @property children - The text to display in the heading.\n */\ntype HeadingProps = {\n children: StringElement;\n};\n\nconst TYPE = 'Heading';\n\n/**\n * A heading component, which is used to display heading text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the heading.\n * @returns A heading element.\n * @example\n * Hello world!\n */\nexport const Heading = createSnapComponent(TYPE);\n\n/**\n * A heading element.\n *\n * @see Heading\n */\nexport type HeadingElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Image} component.\n *\n * @property src - The SVG image to display. This should be an SVG string, and\n * other formats such as PNG and JPEG are not supported directly. You can use\n * the `data:` URL scheme to embed images inside the SVG.\n * @property alt - The alternative text of the image, which describes the image\n * for users who cannot see it.\n */\ntype ImageProps = {\n src: string;\n alt?: string | undefined;\n};\n\nconst TYPE = 'Image';\n\n/**\n * An image component, which is used to display an image.\n *\n * This component does not accept any children.\n *\n * @param props - The props of the component.\n * @param props.src - The URL of the image to display. This should be an SVG\n * string, and other formats such as PNG and JPEG are not supported directly.\n * You can use the `data:` URL scheme to embed images inside the SVG.\n * @param props.alt - The alternative text of the image, which describes the\n * image for users who cannot see it.\n * @returns An image element.\n * @example\n * ...\" alt=\"An example image\" />\n */\nexport const Image = createSnapComponent(TYPE);\n\n/**\n * An image element.\n *\n * @see Image\n */\nexport type ImageElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * Click here\n */\nexport const Link = createSnapComponent(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { AddressElement } from './Address';\nimport type { ImageElement } from './Image';\nimport type { TextElement } from './Text';\nimport type { ValueElement } from './Value';\n\n/**\n * The children of a {@link Row} component.\n */\nexport type RowChildren =\n | AddressElement\n | ImageElement\n | TextElement\n | ValueElement;\n\n/**\n * The props of the {@link Row} component.\n *\n * @property label - The label of the row.\n * @property children - The content of the row. This can be an address, an\n * image, or text.\n * @property variant - The variant of the row.\n * @property tooltip - An optional tooltip to show for the row.\n */\nexport type RowProps = {\n label: string;\n children: RowChildren;\n variant?: 'default' | 'warning' | 'critical' | undefined;\n tooltip?: string | undefined;\n};\n\nconst TYPE = 'Row';\n\n/**\n * A row component, which is used to display a row of information.\n *\n * @param props - The props of the component.\n * @param props.label - The label of the row.\n * @param props.children - The content of the row. This can be an address, an\n * image, or text.\n * @param props.variant - The variant of the row.\n * @param props.tooltip - An optional tooltip to show for the row.\n * @returns A row element.\n * @example\n * \n *
\n * \n */\nexport const Row = createSnapComponent(TYPE);\n\n/**\n * A row element.\n *\n * @see Row\n */\nexport type RowElement = ReturnType;\n","import { createSnapComponent } from '../component';\n\nconst TYPE = 'Spinner';\n\n/**\n * A spinner component, which is used to display a spinner, indicating that some\n * operation is in progress.\n *\n * This component does not accept any props.\n *\n * @returns A spinner element.\n * @example\n * \n */\nexport const Spinner = createSnapComponent(TYPE);\n\n/**\n * A spinner element.\n *\n * @see Spinner\n */\nexport type SpinnerElement = ReturnType;\n","import type { SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { LinkElement } from './Link';\n\n/**\n * The children of the {@link Text} component.\n */\nexport type TextChildren = SnapsChildren<\n string | StandardFormattingElement | LinkElement\n>;\n\n/**\n * The props of the {@link Text} component.\n *\n * @property children - The text to display.\n */\nexport type TextProps = {\n children: TextChildren;\n alignment?: 'start' | 'center' | 'end' | undefined;\n};\n\nconst TYPE = 'Text';\n\n/**\n * A text component, which is used to display text.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display.\n * @returns A text element.\n * @example\n * \n * Hello world!\n * \n * @example\n * \n * Hello world!\n * \n */\nexport const Text = createSnapComponent(TYPE);\n\n/**\n * A text element.\n *\n * @see Text\n */\nexport type TextElement = ReturnType;\n","import { createSnapComponent } from '../component';\nimport type { StandardFormattingElement } from './formatting';\nimport type { ImageElement } from './Image';\nimport type { LinkElement } from './Link';\nimport type { TextElement } from './Text';\n\nexport type TooltipChildren =\n | TextElement\n | StandardFormattingElement\n | LinkElement\n | ImageElement\n | boolean\n | null;\n\n/**\n * The props of the {@link Tooltip} component.\n *\n * @property children - The children of the box.\n * @property content - The text to display in the tooltip.\n */\nexport type TooltipProps = {\n children: TooltipChildren;\n content: TextElement | StandardFormattingElement | LinkElement | string;\n};\n\nconst TYPE = 'Tooltip';\n\n/**\n * A tooltip component, which is used to display text in a tooltip.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the tooltip.\n * @param props.content - The text to display in the tooltip.\n * @returns A tooltip element.\n * @example\n * \n * Hello world!\n * \n * @example\n * Text with formatting}>\n * Hello world!\n * \n */\nexport const Tooltip = createSnapComponent(TYPE);\n\n/**\n * A tooltip element.\n *\n * @see Tooltip\n */\nexport type TooltipElement = ReturnType;\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAoFA,SAAS,qBAA+C,OAAqB;AAC3E,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAAA,EACjE;AACF;AAUO,SAAS,oBAGd,MAAwC;AACxC,SAAO,CAAC,UAAwC;AAC9C,UAAM,EAAE,MAAM,MAAM,GAAG,KAAK,IAAI;AAChC,WAAO;AAAA,MACL;AAAA,MACA,OAAO,qBAAqB,IAAa;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;;;ACrFA,IAAM,OAAO;AAYN,IAAM,SAAS,oBAA8C,IAAI;;;ACnBxE,IAAMA,QAAO;AAeN,IAAM,WAAW,oBAAgDA,KAAI;;;ACf5E,IAAMC,QAAO;AAkBN,IAAM,WAAW,oBAAgDA,KAAI;;;ACpB5E,IAAMC,QAAO;AAkBN,IAAM,SAAS,oBAA8CA,KAAI;;;ACTxE,IAAMC,QAAO;AAqBN,IAAM,QAAQ,oBAA6CA,KAAI;;;AC3BtE,IAAMC,QAAO;AA0BN,IAAM,YAAY,oBAAiDA,KAAI;;;AC5B9E,IAAMC,QAAO;AAmBN,IAAM,OAAO,oBAA4CA,KAAI;;;AChBpE,IAAMC,QAAO;AAeN,IAAM,QAAQ,oBAA6CA,KAAI;;;ACZtE,IAAMC,Q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A,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","TYPE","string","string","element"]} -\ No newline at end of file -diff --git a/dist/jsx/jsx-dev-runtime.js.map b/dist/jsx/jsx-dev-runtime.js.map -index 1e5fc396137dbe46ac2b6d8d1b43d754e9144d5e..c3d6e09bfa464571f12c6497d55c4c8b009525cf 100644 ---- a/dist/jsx/jsx-dev-runtime.js.map -+++ b/dist/jsx/jsx-dev-runtime.js.map -@@ -1 +1,27 @@ --{"version":3,"sources":["../../src/jsx/jsx-dev-runtime.ts","../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n", -+ "import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n", -+ "import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n", -+ "import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n", -+ "import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n", -+ "import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from 'superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from 'superstruct/dist/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from 'superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from 'superstruct';\nimport type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from 'superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from 'superstruct/dist/utils';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from 'superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAA;AAAA,EACA;AAAA,OACK;;;AClBP;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AA0BA,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,SAAS,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;;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A,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["string","string","element"]} -\ No newline at end of file -+{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","import {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n InferStructTuple,\n ObjectSchema,\n} from '@metamask/superstruct';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable(\n struct: Struct,\n): Struct, any> {\n const nestableStruct: Struct> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\n ]);\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable | InferStructTuple[number] | boolean | null>,\n null\n> {\n return nestable(nullable(nullUnion([...structs, boolean()])));\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe = element('Button', {\n children: StringElementStruct,\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: nullUnion([\n tuple([InputStruct, ButtonStruct]),\n DropdownStruct,\n FileInputStruct,\n InputStruct,\n CheckboxStruct,\n ]),\n});\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe = element('Form', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe = element('Address', {\n address: HexChecksumAddressStruct,\n});\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe = element('Box', {\n children: children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n ) as unknown as Struct, null>,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\n]);\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\n]);\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe = element('Row', {\n label: string(),\n children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = nullUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = BoxChildStruct;\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe = nullUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n","import type { Infer } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport type { AnyStruct, InferStructTuple } from '@metamask/superstruct';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal(value: Type) {\n return define(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer | InferStructTuple[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue(\n constant: Type,\n): Struct, null> {\n return literal(constant as EnumToUnion);\n}\n","import type { Infer, Struct } from '@metamask/superstruct';\nimport type {\n AnyStruct,\n EnumSchema,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion = [Type] extends [UnionToIntersection] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema = IsUnion extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch]\n ? null\n : [Type] extends [IsUnion]\n ? EnumSchema\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple\n ? null\n : Struct\n : Type extends object\n ? Type extends IsRecord\n ? null\n : {\n [InnerKey in keyof Type]: Describe;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe = Struct>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion(\n structs: [head: Head, ...tail: Tail],\n): Struct | InferStructTuple[number], null> {\n return union(structs) as unknown as Struct<\n Infer | InferStructTuple[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('(\n component: SnapComponent,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;ACzCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAA;AAAA,EACA;AA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,QAAO;AAAA,EACd,UAAU,UAAU,CAAC,eAAe,aAAa,YAAY,WAAW,CAAC;AAAA,EACzE,SAAS;AAAA,IACP,UAAU,CAAC,QAAQ,SAAS,GAAG,QAAQ,SAAS,GAAG,QAAQ,UAAU,CAAC,CAAC;AAAA,EACzE;AAAA,EACA,SAAS,SAASA,QAAO,CAAC;AAC5B,CAAC;AAKM,IAAM,gBAA0C,QAAQ,SAAS;AAOjE,IAAM,iBAAiB,UAAU;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,mBAAyC,UAAU;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAO,GAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AI5dO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["string","string","element"]} -\ No newline at end of file -diff --git a/dist/types/internals/jsx.d.ts b/dist/types/internals/jsx.d.ts -index 29e858a8689399c6b322fca954fb45416b4e49c9..5c948dd3f7d5e76947f4ef8d40038f197e8e69a2 100644 ---- a/dist/types/internals/jsx.d.ts -+++ b/dist/types/internals/jsx.d.ts -@@ -1,5 +1,5 @@ --import type { Infer, Struct } from 'superstruct'; --import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from 'superstruct/dist/utils'; -+import type { Infer, Struct } from '@metamask/superstruct'; -+import type { AnyStruct, EnumSchema, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, UnionToIntersection } from '@metamask/superstruct'; - import type { EmptyObject } from '../types'; - /** - * Check if a type is a union. Infers `true` if it is a union, otherwise -diff --git a/dist/types/internals/structs.d.ts b/dist/types/internals/structs.d.ts -index bbfc1289001614aa48dca8aef392f619be8281bb..f4f2d1187c88f28d68b9ddae42bd535bfd1cbfed 100644 ---- a/dist/types/internals/structs.d.ts -+++ b/dist/types/internals/structs.d.ts -@@ -1,6 +1,6 @@ --import type { Infer } from 'superstruct'; --import { Struct } from 'superstruct'; --import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; -+import type { Infer } from '@metamask/superstruct'; -+import { Struct } from '@metamask/superstruct'; -+import type { AnyStruct, InferStructTuple } from '@metamask/superstruct'; - import type { EnumToUnion } from './helpers'; - /** - * A wrapper of `superstruct`'s `literal` struct that also defines the name of -diff --git a/dist/types/internals/svg.d.ts b/dist/types/internals/svg.d.ts -index cda3bd7e7b1cde37099c830ce451ac6d5c190b4a..cd4a5d29aa53d1eac86eac29533d468d160e5d8c 100644 ---- a/dist/types/internals/svg.d.ts -+++ b/dist/types/internals/svg.d.ts -@@ -4,4 +4,4 @@ - * @returns A Struct that validates a string as a valid SVG. - * @internal - */ --export declare function svg(): import("superstruct").Struct; -+export declare function svg(): import("@metamask/superstruct").Struct; -diff --git a/dist/types/jsx/validation.d.ts b/dist/types/jsx/validation.d.ts -index 21db53ee2779ef671a7b850f3d5bfb44fd9ff658..8574d03c250f8d4b932af45266f8f48a529b2b5a 100644 ---- a/dist/types/jsx/validation.d.ts -+++ b/dist/types/jsx/validation.d.ts -@@ -1,4 +1,4 @@ --import type { Struct } from 'superstruct'; -+import type { Struct } from '@metamask/superstruct'; - import type { Describe } from '../internals'; - import type { GenericSnapElement, Key, SnapElement, StringElement } from './component'; - import type { AddressElement, BoldElement, BoxElement, ButtonElement, CheckboxElement, CopyableElement, DividerElement, DropdownElement, OptionElement, FieldElement, FormElement, HeadingElement, ImageElement, InputElement, ItalicElement, JSXElement, LinkElement, RowElement, SpinnerElement, StandardFormattingElement, TextElement, TooltipElement, ValueElement, FileInputElement } from './components'; -diff --git a/dist/types/types/handlers/user-input.d.ts b/dist/types/types/handlers/user-input.d.ts -index d62972089a6492d765da7389902eb00c2aff6069..44afb0ee2c2a7ea0e4c8ab1460409b7df1adbcab 100644 ---- a/dist/types/types/handlers/user-input.d.ts -+++ b/dist/types/types/handlers/user-input.d.ts -@@ -1,4 +1,4 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import type { InterfaceContext } from '../interface'; - /** - * The type of user input event fired. -@@ -15,19 +15,19 @@ export declare enum UserInputEventType { - InputChangeEvent = "InputChangeEvent", - FileUploadEvent = "FileUploadEvent" - } --export declare const GenericEventStruct: import("superstruct").Struct<{ -+export declare const GenericEventStruct: import("@metamask/superstruct").Struct<{ - type: string; - name?: string | undefined; - }, { -- type: import("superstruct").Struct; -- name: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; - }>; --export declare const ButtonClickEventStruct: import("superstruct").Struct<{ -+export declare const ButtonClickEventStruct: import("@metamask/superstruct").Struct<{ - type: UserInputEventType.ButtonClickEvent; - name?: string | undefined; - }, { -- type: import("superstruct").Struct; -- name: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; - }>; - /** - * A button click event fired in the UI. This is passed to the params of the -@@ -38,16 +38,16 @@ export declare const ButtonClickEventStruct: import("superstruct").Struct<{ - * @property name - The optional component name that fired the event. - */ - export declare type ButtonClickEvent = Infer; --export declare const FileStruct: import("superstruct").Struct<{ -+export declare const FileStruct: import("@metamask/superstruct").Struct<{ - name: string; - size: number; - contentType: string; - contents: string; - }, { -- name: import("superstruct").Struct; -- size: import("superstruct").Struct; -- contentType: import("superstruct").Struct; -- contents: import("superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; -+ size: import("@metamask/superstruct").Struct; -+ contentType: import("@metamask/superstruct").Struct; -+ contents: import("@metamask/superstruct").Struct; - }>; - /** - * A file object containing the file name, size, content type, and the base64 -@@ -59,7 +59,7 @@ export declare const FileStruct: import("superstruct").Struct<{ - * @property contents - The base64 encoded contents of the file. - */ - export declare type File = Infer; --export declare const FormSubmitEventStruct: import("superstruct").Struct<{ -+export declare const FormSubmitEventStruct: import("@metamask/superstruct").Struct<{ - value: Record; -- value: import("superstruct").Struct; -+ value: import("@metamask/superstruct").Struct, null>; -- name: import("superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; - }>; - /** - * A form submit event, which is fired when a submit button is clicked. -@@ -92,14 +92,14 @@ export declare const FormSubmitEventStruct: import("superstruct").Struct<{ - * {@link File}. - */ - export declare type FormSubmitEvent = Infer; --export declare const InputChangeEventStruct: import("superstruct").Struct<{ -+export declare const InputChangeEventStruct: import("@metamask/superstruct").Struct<{ - value: string | boolean; - type: UserInputEventType.InputChangeEvent; - name: string; - }, { -- type: import("superstruct").Struct; -- name: import("superstruct").Struct; -- value: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; - }>; - /** - * An input change event, which is fired when the value of an input field -@@ -110,7 +110,7 @@ export declare const InputChangeEventStruct: import("superstruct").Struct<{ - * @property value - The new value of the input field. - */ - export declare type InputChangeEvent = Infer; --export declare const FileUploadEventStruct: import("superstruct").Struct<{ -+export declare const FileUploadEventStruct: import("@metamask/superstruct").Struct<{ - type: UserInputEventType.FileUploadEvent; - name: string; - file: { -@@ -120,18 +120,18 @@ export declare const FileUploadEventStruct: import("superstruct").Struct<{ - contents: string; - } | null; - }, { -- type: import("superstruct").Struct; -- name: import("superstruct").Struct; -- file: import("superstruct").Struct<{ -+ type: import("@metamask/superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; -+ file: import("@metamask/superstruct").Struct<{ - name: string; - size: number; - contentType: string; - contents: string; - } | null, { -- name: import("superstruct").Struct; -- size: import("superstruct").Struct; -- contentType: import("superstruct").Struct; -- contents: import("superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; -+ size: import("@metamask/superstruct").Struct; -+ contentType: import("@metamask/superstruct").Struct; -+ contents: import("@metamask/superstruct").Struct; - }>; - }>; - /** -@@ -145,7 +145,7 @@ export declare const FileUploadEventStruct: import("superstruct").Struct<{ - * @see File - */ - export declare type FileUploadEvent = Infer; --export declare const UserInputEventStruct: import("superstruct").Struct<{ -+export declare const UserInputEventStruct: import("@metamask/superstruct").Struct<{ - type: UserInputEventType.ButtonClickEvent; - name?: string | undefined; - } | { -diff --git a/dist/types/types/interface.d.ts b/dist/types/types/interface.d.ts -index a927a12f5a07f0f7a1a239499ae7a88015b7ffa8..7d7bd5b46ccf0435b3e9e032f8380d7dfffcf3a4 100644 ---- a/dist/types/types/interface.d.ts -+++ b/dist/types/types/interface.d.ts -@@ -1,4 +1,4 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import type { JSXElement } from '../jsx'; - import type { Component } from '../ui'; - /** -@@ -7,19 +7,19 @@ import type { Component } from '../ui'; - * root state) and the root state since a key in the root stat can contain - * either the value of an input or a sub-state of a form. - */ --export declare const StateStruct: import("superstruct").Struct; --export declare const FormStateStruct: import("superstruct").Struct, null>; --export declare const InterfaceStateStruct: import("superstruct").Struct; - export declare type FormState = Infer; - export declare type InterfaceState = Infer; - export declare type ComponentOrElement = Component | JSXElement; --export declare const ComponentOrElementStruct: import("superstruct").Struct<{ -+export declare const ComponentOrElementStruct: import("@metamask/superstruct").Struct<{ - value: string; - type: import("../ui").NodeType.Copyable; - sensitive?: boolean | undefined; -@@ -108,5 +108,5 @@ export declare const ComponentOrElementStruct: import("superstruct").Struct<{ - src: string; - alt?: string | undefined; - }, "Image"> | import("../jsx").SnapElement | import("../jsx").SnapElement | import("../jsx").SnapElement | import("../jsx").SnapElement, "Spinner"> | import("../jsx").SnapElement, null>; --export declare const InterfaceContextStruct: import("superstruct").Struct, null>; -+export declare const InterfaceContextStruct: import("@metamask/superstruct").Struct, null>; - export declare type InterfaceContext = Infer; -diff --git a/dist/types/ui/builder.d.ts b/dist/types/ui/builder.d.ts -index cdbb9fec64a64302ee6d8b0441faa872c6d4b48f..b03d1adb44a055a2af2e1442aa5395f614a89219 100644 ---- a/dist/types/ui/builder.d.ts -+++ b/dist/types/ui/builder.d.ts -@@ -1,4 +1,4 @@ --import type { Struct } from 'superstruct'; -+import type { Struct } from '@metamask/superstruct'; - import type { Component } from './components'; - import type { NodeType } from './nodes'; - /** -diff --git a/dist/types/ui/components/address.d.ts b/dist/types/ui/components/address.d.ts -index fc348d22cba13fba7ada95b86df12371268b0c82..e813400f74734a036aefb4c638dd87dcafac97dd 100644 ---- a/dist/types/ui/components/address.d.ts -+++ b/dist/types/ui/components/address.d.ts -@@ -1,11 +1,11 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const AddressStruct: import("superstruct").Struct<{ -+export declare const AddressStruct: import("@metamask/superstruct").Struct<{ - value: `0x${string}`; - type: NodeType.Address; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct<`0x${string}`, null>; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct<`0x${string}`, null>; - }>; - /** - * A address node, that renders an EVM-like address and its icon. -diff --git a/dist/types/ui/components/button.d.ts b/dist/types/ui/components/button.d.ts -index 93e515c52bc31e95c8737a1ebe3efd2b89037aed..f986028d23272e3f5ac56c406c14b5e1ee0c4034 100644 ---- a/dist/types/ui/components/button.d.ts -+++ b/dist/types/ui/components/button.d.ts -@@ -1,4 +1,4 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; - export declare enum ButtonVariant { - Primary = "primary", -@@ -8,18 +8,18 @@ export declare enum ButtonType { - Button = "button", - Submit = "submit" - } --export declare const ButtonStruct: import("superstruct").Struct<{ -+export declare const ButtonStruct: import("@metamask/superstruct").Struct<{ - value: string; - type: NodeType.Button; - name?: string | undefined; - variant?: "primary" | "secondary" | undefined; - buttonType?: "button" | "submit" | undefined; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct; -- variant: import("superstruct").Struct<"primary" | "secondary" | undefined, null>; -- buttonType: import("superstruct").Struct<"button" | "submit" | undefined, null>; -- name: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; -+ variant: import("@metamask/superstruct").Struct<"primary" | "secondary" | undefined, null>; -+ buttonType: import("@metamask/superstruct").Struct<"button" | "submit" | undefined, null>; -+ name: import("@metamask/superstruct").Struct; - }>; - /** - * A button node, that renders either a primary or a secondary button. -diff --git a/dist/types/ui/components/copyable.d.ts b/dist/types/ui/components/copyable.d.ts -index f89ae230dc0631692934113df5659fe6dd428f69..2949ed74cc6881e034332e67427c742b918b3b12 100644 ---- a/dist/types/ui/components/copyable.d.ts -+++ b/dist/types/ui/components/copyable.d.ts -@@ -1,13 +1,13 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const CopyableStruct: import("superstruct").Struct<{ -+export declare const CopyableStruct: import("@metamask/superstruct").Struct<{ - value: string; - type: NodeType.Copyable; - sensitive?: boolean | undefined; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct; -- sensitive: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; -+ sensitive: import("@metamask/superstruct").Struct; - }>; - /** - * Text that can be copied to the clipboard. It can optionally be marked as -diff --git a/dist/types/ui/components/divider.d.ts b/dist/types/ui/components/divider.d.ts -index c083b5254173b6bf1f251a7a6dfef439fedde091..768552d67230c39db125bb6e8c0a351a521f2652 100644 ---- a/dist/types/ui/components/divider.d.ts -+++ b/dist/types/ui/components/divider.d.ts -@@ -1,9 +1,9 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const DividerStruct: import("superstruct").Struct<{ -+export declare const DividerStruct: import("@metamask/superstruct").Struct<{ - type: NodeType.Divider; - }, { -- type: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; - }>; - /** - * A divider node, that renders a line between other nodes. -diff --git a/dist/types/ui/components/form.d.ts b/dist/types/ui/components/form.d.ts -index 0e2490c9a6686cd5687d5d51a2a0480622a9e3e7..e968d4743baf19e92f2f2c572577ed08f2b59e2f 100644 ---- a/dist/types/ui/components/form.d.ts -+++ b/dist/types/ui/components/form.d.ts -@@ -1,6 +1,6 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const FormComponentStruct: import("superstruct").Struct<{ -+export declare const FormComponentStruct: import("@metamask/superstruct").Struct<{ - type: NodeType.Input; - name: string; - value?: string | undefined; -@@ -19,7 +19,7 @@ export declare const FormComponentStruct: import("superstruct").Struct<{ - * The subset of nodes allowed as children in the {@link Form} node. - */ - export declare type FormComponent = Infer; --export declare const FormStruct: import("superstruct").Struct<{ -+export declare const FormStruct: import("@metamask/superstruct").Struct<{ - type: NodeType.Form; - name: string; - children: ({ -@@ -38,8 +38,8 @@ export declare const FormStruct: import("superstruct").Struct<{ - buttonType?: "button" | "submit" | undefined; - })[]; - }, { -- type: import("superstruct").Struct; -- children: import("superstruct").Struct<({ -+ type: import("@metamask/superstruct").Struct; -+ children: import("@metamask/superstruct").Struct<({ - type: NodeType.Input; - name: string; - value?: string | undefined; -@@ -53,7 +53,7 @@ export declare const FormStruct: import("superstruct").Struct<{ - name?: string | undefined; - variant?: "primary" | "secondary" | undefined; - buttonType?: "button" | "submit" | undefined; -- })[], import("superstruct").Struct<{ -+ })[], import("@metamask/superstruct").Struct<{ - type: NodeType.Input; - name: string; - value?: string | undefined; -@@ -68,7 +68,7 @@ export declare const FormStruct: import("superstruct").Struct<{ - variant?: "primary" | "secondary" | undefined; - buttonType?: "button" | "submit" | undefined; - }, null>>; -- name: import("superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; - }>; - /** - * A form node that takes children {@link FormComponent} nodes and renders a form. -diff --git a/dist/types/ui/components/heading.d.ts b/dist/types/ui/components/heading.d.ts -index 0c88af706c0e9fa06356a0ff0e3ce39e3396fc01..5822d5120181f3d44b5b8455895e0bb7e3620fdf 100644 ---- a/dist/types/ui/components/heading.d.ts -+++ b/dist/types/ui/components/heading.d.ts -@@ -1,11 +1,11 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const HeadingStruct: import("superstruct").Struct<{ -+export declare const HeadingStruct: import("@metamask/superstruct").Struct<{ - value: string; - type: NodeType.Heading; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; - }>; - /** - * A heading node, that renders the text as a heading. The level of the heading -diff --git a/dist/types/ui/components/image.d.ts b/dist/types/ui/components/image.d.ts -index 1a98bf991bb019cf4a0bbf28d336f1ba03904a63..191073b8984b739d601a1224521280dcb3e54511 100644 ---- a/dist/types/ui/components/image.d.ts -+++ b/dist/types/ui/components/image.d.ts -@@ -1,11 +1,11 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const ImageStruct: import("superstruct").Struct<{ -+export declare const ImageStruct: import("@metamask/superstruct").Struct<{ - value: string; - type: NodeType.Image; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; - }>; - /** - * An image node, that renders an SVG image. -diff --git a/dist/types/ui/components/input.d.ts b/dist/types/ui/components/input.d.ts -index 51dd69f485dbab7c47aa594288ffae11df7a5334..a488eeaea8eba90ce79de8fbb96fd95f089b7739 100644 ---- a/dist/types/ui/components/input.d.ts -+++ b/dist/types/ui/components/input.d.ts -@@ -1,4 +1,4 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; - /** - * This replicates the available input types from the metamask extension. -@@ -9,7 +9,7 @@ export declare enum InputType { - Number = "number", - Password = "password" - } --export declare const InputStruct: import("superstruct").Struct<{ -+export declare const InputStruct: import("@metamask/superstruct").Struct<{ - type: NodeType.Input; - name: string; - value?: string | undefined; -@@ -18,13 +18,13 @@ export declare const InputStruct: import("superstruct").Struct<{ - inputType?: "number" | "text" | "password" | undefined; - placeholder?: string | undefined; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct; -- name: import("superstruct").Struct; -- inputType: import("superstruct").Struct<"number" | "text" | "password" | undefined, null>; -- placeholder: import("superstruct").Struct; -- label: import("superstruct").Struct; -- error: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; -+ name: import("@metamask/superstruct").Struct; -+ inputType: import("@metamask/superstruct").Struct<"number" | "text" | "password" | undefined, null>; -+ placeholder: import("@metamask/superstruct").Struct; -+ label: import("@metamask/superstruct").Struct; -+ error: import("@metamask/superstruct").Struct; - }>; - /** - * An input node, that renders an input. -diff --git a/dist/types/ui/components/panel.d.ts b/dist/types/ui/components/panel.d.ts -index da4a2742eb6b6e47a06588636d48ed39b6bbcec3..d57f2a6c6e21daefe20f66041cb3fb3b5717acda 100644 ---- a/dist/types/ui/components/panel.d.ts -+++ b/dist/types/ui/components/panel.d.ts -@@ -1,4 +1,4 @@ --import type { Infer, Struct } from 'superstruct'; -+import type { Infer, Struct } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; - /** - * @internal -diff --git a/dist/types/ui/components/row.d.ts b/dist/types/ui/components/row.d.ts -index 048e044f3cca6be0a9a0e8577dd26e139dc00dcb..3a9cf456be9f78bbb1843c1097d715e2a5febc8b 100644 ---- a/dist/types/ui/components/row.d.ts -+++ b/dist/types/ui/components/row.d.ts -@@ -1,11 +1,11 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; - export declare enum RowVariant { - Default = "default", - Critical = "critical", - Warning = "warning" - } --export declare const RowStruct: import("superstruct").Struct<{ -+export declare const RowStruct: import("@metamask/superstruct").Struct<{ - value: { - value: string; - type: NodeType.Image; -@@ -21,10 +21,10 @@ export declare const RowStruct: import("superstruct").Struct<{ - label: string; - variant?: "default" | "warning" | "critical" | undefined; - }, { -- type: import("superstruct").Struct; -- variant: import("superstruct").Struct<"default" | "warning" | "critical" | undefined, null>; -- label: import("superstruct").Struct; -- value: import("superstruct").Struct<{ -+ type: import("@metamask/superstruct").Struct; -+ variant: import("@metamask/superstruct").Struct<"default" | "warning" | "critical" | undefined, null>; -+ label: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct<{ - value: string; - type: NodeType.Image; - } | { -diff --git a/dist/types/ui/components/spinner.d.ts b/dist/types/ui/components/spinner.d.ts -index da3ab733eb22ce714cb7060130cb48ee05e6890a..6e1f57718b358b36d451e5cbbed09c8ab0799c14 100644 ---- a/dist/types/ui/components/spinner.d.ts -+++ b/dist/types/ui/components/spinner.d.ts -@@ -1,9 +1,9 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const SpinnerStruct: import("superstruct").Struct<{ -+export declare const SpinnerStruct: import("@metamask/superstruct").Struct<{ - type: NodeType.Spinner; - }, { -- type: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; - }>; - /** - * A spinner node, that renders a spinner, either as a full-screen overlay, or -diff --git a/dist/types/ui/components/text.d.ts b/dist/types/ui/components/text.d.ts -index 9b2b9531277adde01591a71909718c5f4f172173..711b43681686983b310999c4d0fc59537fc1c8de 100644 ---- a/dist/types/ui/components/text.d.ts -+++ b/dist/types/ui/components/text.d.ts -@@ -1,13 +1,13 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import { NodeType } from '../nodes'; --export declare const TextStruct: import("superstruct").Struct<{ -+export declare const TextStruct: import("@metamask/superstruct").Struct<{ - value: string; - type: NodeType.Text; - markdown?: boolean | undefined; - }, { -- type: import("superstruct").Struct; -- value: import("superstruct").Struct; -- markdown: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; -+ markdown: import("@metamask/superstruct").Struct; - }>; - /** - * A text node, that renders the text as one or more paragraphs. -diff --git a/dist/types/ui/nodes.d.ts b/dist/types/ui/nodes.d.ts -index f1d76b68a43850f65ebf645f69d34247e6ed6b7b..dc1da5ba43f20aba1d7f5c4b84ee7ca56a73ec38 100644 ---- a/dist/types/ui/nodes.d.ts -+++ b/dist/types/ui/nodes.d.ts -@@ -1,4 +1,4 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - /** - * The supported node types. This is based on SIP-7. - * -@@ -21,10 +21,10 @@ export declare enum NodeType { - /** - * @internal - */ --export declare const NodeStruct: import("superstruct").Struct<{ -+export declare const NodeStruct: import("@metamask/superstruct").Struct<{ - type: string; - }, { -- type: import("superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; - }>; - /** - * The base node type. All nodes extend this type. -@@ -37,12 +37,12 @@ export declare type Node = Infer; - /** - * @internal - */ --export declare const LiteralStruct: import("superstruct").Struct<{ -+export declare const LiteralStruct: import("@metamask/superstruct").Struct<{ - value: unknown; - type: string; - }, { -- value: import("superstruct").Struct; -- type: import("superstruct").Struct; -+ value: import("@metamask/superstruct").Struct; -+ type: import("@metamask/superstruct").Struct; - }>; - /** - * A node with a value. This is used for nodes that render a value, such as -diff --git a/package.json b/package.json -index c78de173e59c45bdeb07cd4a19b31a328d2b6bef..706e553b6079739e6fb9740e96bb36a80154b0be 100644 ---- a/package.json -+++ b/package.json -@@ -58,12 +58,15 @@ - "lint:dependencies": "depcheck", - "build:ci": "tsup --clean" - }, -+ "resolutions": { -+ "@metamask/superstruct": "3.1.0" -+ }, - "dependencies": { - "@metamask/key-tree": "^9.1.1", - "@metamask/providers": "^17.0.0", - "@metamask/rpc-errors": "^6.2.1", -- "@metamask/utils": "^8.3.0", -- "superstruct": "^1.0.3" -+ "@metamask/superstruct": "^3.1.0", -+ "@metamask/utils": "^8.3.0" - }, - "devDependencies": { - "@lavamoat/allow-scripts": "^3.0.4", diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch deleted file mode 100644 index d9e2db8379..0000000000 --- a/.yarn/patches/@metamask-snaps-utils-npm-7.4.0-61301b942a.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/dist/chunk-A6E325SZ.js.map b/dist/chunk-A6E325SZ.js.map -index 9395ea8f11127b1883cf0b26f7049254cb1bf6ac..2bab6aca282a11ec815b3a02863423af8260fb85 100644 ---- a/dist/chunk-A6E325SZ.js.map -+++ b/dist/chunk-A6E325SZ.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd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C1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AA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CAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-GTAYOKI4.mjs.map b/dist/chunk-GTAYOKI4.mjs.map -index 87b357f90e691edb205eba4b1d5991f705dc61fb..15cec06a31a88f47929cc8a9b7cecaef5daa8372 100644 ---- a/dist/chunk-GTAYOKI4.mjs.map -+++ b/dist/chunk-GTAYOKI4.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,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,UAAM,IAAI;AAAA,MACR,wBAAwB,KAAK,SAAS,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,IAC5D;AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;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S,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,IAC5D;AAAA,EACF;AAIA,QAAM,cAAc;AACpB,QAAM,gBAAgB,OAAO,OAAO;AAAA,IAAO,CAAC,gBAC1C,GAAG,YAAY,SAAS,GAAG,YAAY,OAAO,SAAS,CAAC;AAAA,EAC1D;AAEA,SAAO,cAAc,SAAS,GAAG,uCAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} -\ No newline at end of file -diff --git a/dist/tsconfig.build.tsbuildinfo b/dist/tsconfig.build.tsbuildinfo -index 2f6c63b450f39745751adbf73598c1756650078e..7f0bf13393f108d3e1df381a86e67556d4749a3d 100644 ---- a/dist/tsconfig.build.tsbuildinfo -+++ b/dist/tsconfig.build.tsbuildinfo -@@ -1 +1 @@ --{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct/dist/utils.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../../snaps-sdk/dist/types/jsx/component.d.ts","../../snaps-sdk/dist/types/jsx/components/Address.d.ts","../../snaps-sdk/dist/types/jsx/components/Box.d.ts","../../snaps-sdk/dist/types/jsx/components/Copyable.d.ts","../../snaps-sdk/dist/types/jsx/components/Divider.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Button.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Input.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Field.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Form.d.ts","../../snaps-sdk/dist/types/jsx/components/form/index.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Bold.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Italic.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/index.d.ts","../../snaps-sdk/dist/types/jsx/components/Heading.d.ts","../../snaps-sdk/dist/types/jsx/components/Image.d.ts","../../snaps-sdk/dist/types/jsx/components/Link.d.ts","../../snaps-sdk/dist/types/jsx/components/Text.d.ts","../../snaps-sdk/dist/types/jsx/components/Row.d.ts","../../snaps-sdk/dist/types/jsx/components/Spinner.d.ts","../../snaps-sdk/dist/types/jsx/components/index.d.ts","../../snaps-sdk/dist/types/jsx/jsx-runtime.d.ts","../../snaps-sdk/dist/types/jsx/jsx-dev-runtime.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../../snaps-sdk/dist/types/errors.d.ts","../../snaps-sdk/dist/types/internals/error-wrappers.d.ts","../../snaps-sdk/dist/types/internals/errors.d.ts","../../snaps-sdk/dist/types/internals/helpers.d.ts","../../snaps-sdk/dist/types/internals/structs.d.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../../snaps-sdk/dist/types/types/methods/create-interface.d.ts","../../snaps-sdk/dist/types/types/methods/dialog.d.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../../snaps-sdk/dist/types/types/caip.d.ts","../../snaps-sdk/dist/types/types/permissions.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-public-key.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip44-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-client-status.d.ts","../../snaps-sdk/dist/types/types/methods/get-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-file.d.ts","../../snaps-sdk/dist/types/ui/nodes.d.ts","../../snaps-sdk/dist/types/ui/components/address.d.ts","../../snaps-sdk/dist/types/ui/components/copyable.d.ts","../../snaps-sdk/dist/types/ui/components/divider.d.ts","../../snaps-sdk/dist/types/ui/components/heading.d.ts","../../snaps-sdk/dist/types/ui/components/image.d.ts","../../snaps-sdk/dist/types/ui/components/panel.d.ts","../../snaps-sdk/dist/types/ui/components/spinner.d.ts","../../snaps-sdk/dist/types/ui/components/text.d.ts","../../snaps-sdk/dist/types/ui/components/row.d.ts","../../snaps-sdk/dist/types/ui/components/button.d.ts","../../snaps-sdk/dist/types/ui/components/input.d.ts","../../snaps-sdk/dist/types/ui/components/form.d.ts","../../snaps-sdk/dist/types/ui/components/index.d.ts","../../snaps-sdk/dist/types/ui/component.d.ts","../../snaps-sdk/dist/types/ui/index.d.ts","../../snaps-sdk/dist/types/types/interface.d.ts","../../snaps-sdk/dist/types/types/methods/get-interface-state.d.ts","../../snaps-sdk/dist/types/types/methods/get-locale.d.ts","../../snaps-sdk/dist/types/types/snap.d.ts","../../snaps-sdk/dist/types/types/methods/get-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-snap.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-keyring.d.ts","../../snaps-sdk/dist/types/types/methods/manage-accounts.d.ts","../../snaps-sdk/dist/types/types/methods/manage-state.d.ts","../../snaps-sdk/dist/types/types/methods/notify.d.ts","../../snaps-sdk/dist/types/types/methods/request-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/update-interface.d.ts","../../snaps-sdk/dist/types/types/methods/methods.d.ts","../../snaps-sdk/dist/types/types/methods/index.d.ts","../../snaps-sdk/dist/types/types/provider.d.ts","../../snaps-sdk/dist/types/types/global.d.ts","../../snaps-sdk/dist/types/types/images.d.ts","../../snaps-sdk/dist/types/types/handlers/cronjob.d.ts","../../snaps-sdk/dist/types/types/handlers/home-page.d.ts","../../snaps-sdk/dist/types/types/handlers/keyring.d.ts","../../snaps-sdk/dist/types/types/handlers/lifecycle.d.ts","../../snaps-sdk/dist/types/types/handlers/name-lookup.d.ts","../../snaps-sdk/dist/types/types/handlers/rpc-request.d.ts","../../snaps-sdk/dist/types/types/handlers/transaction.d.ts","../../snaps-sdk/dist/types/types/handlers/signature.d.ts","../../snaps-sdk/dist/types/types/handlers/user-input.d.ts","../../snaps-sdk/dist/types/types/handlers/index.d.ts","../../snaps-sdk/dist/types/types/index.d.ts","../../snaps-sdk/dist/types/internals/jsx.d.ts","../../snaps-sdk/dist/types/internals/svg.d.ts","../../snaps-sdk/dist/types/internals/index.d.ts","../../snaps-sdk/dist/types/jsx/validation.d.ts","../../snaps-sdk/dist/types/jsx/index.d.ts","../src/array.ts","../../snaps-sdk/dist/types/error-wrappers.d.ts","../../snaps-sdk/dist/types/images.d.ts","../../snaps-sdk/dist/types/index.d.ts","../../../node_modules/@scure/base/lib/index.d.ts","../../../node_modules/rfdc/index.d.ts","../src/deep-clone.ts","../src/virtual-file/VirtualFile.ts","../src/bytes.ts","../src/virtual-file/index.ts","../src/base64.ts","../src/auxiliary-files.ts","../src/caveats.ts","../../../node_modules/@noble/hashes/utils.d.ts","../../../node_modules/@noble/hashes/_md.d.ts","../../../node_modules/@noble/hashes/sha256.d.ts","../src/checksum.ts","../../../node_modules/cron-parser/types/common.d.ts","../../../node_modules/cron-parser/types/index.d.ts","../../../node_modules/cron-parser/index.d.ts","../src/cronjob.ts","../src/default-endowments.ts","../../../node_modules/@metamask/slip44/slip44.json","../src/derivation-paths.ts","../src/entropy.ts","../src/errors.ts","../src/handler-types.ts","../src/mock.ts","../src/eval-worker.ts","../src/json.ts","../src/virtual-file/toVirtualFile.ts","../src/virtual-file/node.ts","../src/fs.ts","../src/eval.ts","../src/handlers.ts","../src/icon.ts","../src/iframe.ts","../src/iframe.test.browser.ts","../src/logging.ts","../../../node_modules/chalk/index.d.ts","../src/strings.ts","../src/structs.ts","../src/namespace.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV1.d.ts","../../../node_modules/immer/dist/utils/env.d.ts","../../../node_modules/immer/dist/utils/errors.d.ts","../../../node_modules/immer/dist/types/types-external.d.ts","../../../node_modules/immer/dist/types/types-internal.d.ts","../../../node_modules/immer/dist/utils/common.d.ts","../../../node_modules/immer/dist/utils/plugins.d.ts","../../../node_modules/immer/dist/core/scope.d.ts","../../../node_modules/immer/dist/core/finalize.d.ts","../../../node_modules/immer/dist/core/proxy.d.ts","../../../node_modules/immer/dist/core/immerClass.d.ts","../../../node_modules/immer/dist/core/current.d.ts","../../../node_modules/immer/dist/internal.d.ts","../../../node_modules/immer/dist/plugins/es5.d.ts","../../../node_modules/immer/dist/plugins/patches.d.ts","../../../node_modules/immer/dist/plugins/mapset.d.ts","../../../node_modules/immer/dist/plugins/all.d.ts","../../../node_modules/immer/dist/immer.d.ts","../../../node_modules/@metamask/base-controller/dist/types/RestrictedControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/ControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV2.d.ts","../../../node_modules/@metamask/base-controller/dist/types/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/types.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/constants.d.ts","../../../node_modules/@metamask/eth-query/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/util.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/abnf.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/utils.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/parsers.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/siwe.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/index.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/ApprovalController.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/permission-middleware.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/SubjectMetadataController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/PermissionController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Permission.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Caveat.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/utils.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/getPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/requestPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/revokePermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/index.d.ts","../src/json-rpc.ts","../../../node_modules/@metamask/snaps-registry/dist/verify.d.ts","../../../node_modules/@metamask/snaps-registry/dist/index.d.ts","../../../node_modules/fast-json-stable-stringify/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../src/snaps.ts","../src/manifest/validation.ts","../src/manifest/index.ts","../src/localization.ts","../src/types.ts","../src/index.executionenv.ts","../src/path.ts","../../../node_modules/marked/lib/marked.d.ts","../src/ui.tsx","../src/validation.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../src/versions.ts","../src/index.ts","../../../node_modules/fast-deep-equal/index.d.ts","../src/npm.ts","../src/manifest/manifest.ts","../src/manifest/node.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../src/post-process.ts","../src/node.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f","c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b","9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff","44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e","043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3","e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3","5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d","cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef","16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3","f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d","87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060","c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add","efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac","3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe","bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58","b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3","5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51","8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21","8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60","b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1","77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a","31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba","d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41","9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d","6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4","cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff","9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c","a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0","0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34","fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2","ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269","3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284","5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2","6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8","0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554","5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609","80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a","2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643","cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3","9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94","122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45","f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08","0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36","e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8","5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335","92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590","3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd","20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870","078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51","68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d","56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7","2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed","620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f","6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0","080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d","874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c","6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749","6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96","d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a","747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2","b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c","e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71","b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c","15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1","4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183","73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3","3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941","3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1","50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e","3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c","72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb","f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf",{"version":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e","9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c","aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1","150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2","cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20","47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a","6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47","afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228","df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494","03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88","11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0","cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc","959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383","6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0","2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232","1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563","58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3",{"version":"2f700dfc0b29df3605475fcd717c0fc759c95e42067c389cbb503ba3bde9b155","signature":"00abf32ca3af92f8be9ecbc9b63090b4909a756317d791927a83cffd24e9c8ac"},"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10","6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3","abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6","27e882f5d19aee4c49dbdebedbfa79c3233b874adcdcac46295232c4c1bcd13b","1ce746559c2b493ba53418bb35dcfb13b8581bed88c0ac484d92b004077c4b4e",{"version":"27d30b08ab92c978b5f2bbda4a242ea927f908287edce0c2ed11ddcf52c80e01","signature":"900daf04dc607dc3858c0f976d6f9e17b829a07de58d62dc6f730eaf06986075"},{"version":"26351dd9044d932d46fc6472737c5335df5b4a9ad5f1ee1c157d328beb6744f4","signature":"8b2100d3ba68063b7baf5038f26eefe46543dcebf1e7dbaf46277f24307cefcb"},{"version":"5a55c1d9a73f1a1867915a6f043c5d05a439291aec5482b918012ab2d939f809","signature":"aa4d6dc9282133162a76109d99c5795583276c4fd27284f128d484acf12b0841"},"131b7f32092aa78e12fcb2a6db7c71e17f85e076c0635ad8d991b80d10130c19",{"version":"be3a09b63c0d3639c5fd497ed6d3f00fa61ba633e74b841108844ee3b3ff3f47","signature":"d1c84af1e6d5fa4a5f4badd45b03b67c9255a675df235a3ec25307a0f5524278"},{"version":"22f6df7b5f345f4934e261e6b3923d5d28ebf3049349ac8f2921311527217f55","signature":"cd28efe88fac7a92f3f5cfc7dd3c764f0b31bdaaa061ff044de1639810d6a7da"},{"version":"2341c1f3e039d9c25368a901d6c7e64d3743cc2d6b6c4a15fb8f1d194d3c8149","signature":"3355c4c572f076ad963d95f0e28075b8558e2ab492c84eb94f9e2c48f1c2368b"},"cd60a513d4653eb2e9c95b3351cbad232238f140c3eb4f3d48e93ceff7dd7bf7","f3787e74811e0328d91ebf9c1662a50501f457e2df45f53d85b3846c09d015ea","fc670c1c1c1b74b85d4305ea97d18292184b434c7168d40ed60658e187d0e40d",{"version":"e3fc829c75c12182fdad28349413c986d3de96abfd44612d9f4c7668e0f0564f","signature":"5638cfd48b0c56bc9ed0c779d53a40b92c9cd9c9d6312e3a21c52542d38094f3"},"827eb54656695635a6e25543f711f0fe86d1083e5e1c0e84f394ffc122bd3ad7","2309cee540edc190aa607149b673b437cb8807f4e8d921bf7f5a50e6aa8d609c","908a84aef7827422ff7c8623c661bcf2bcb0cb7a30aea39e82a79bbc09042ef6",{"version":"02e8e7131fc1abd33966d638fe9d7aacd18cd63b4310c8cc94d90e8bf9156557","signature":"703509e96cc30dce834ef8188c958c69306473b8a7e5cb3a6f324cee05a1f7bb"},{"version":"0f2be331f7b616109c9bde1fffb31ba7b34efccefe33d4f049735124a273ab4b","signature":"08e0ac95e650bd4c87145b6ab2257b70c06254bf76a0b9f8a7d60c51fb8ed6b8"},"c7d095626fe7d891fdd339ff01cc1d11eae282ca968059f8f3b39a697d8d452b",{"version":"a17d45077b1f4365945d9a515c9f46d3d19bba48b95e34e328c8bba6b5185181","signature":"4b57ec505a035491c692b89af2c6902c312ec22f8fa9b6dae3e93686659fb7e0"},{"version":"d7b7b7bcac03a91ce4f8c1eabe83c37036114662eadab96fbabae768e1572dc9","signature":"7d796672940d3b2d37f2edea4d7bcf4c7993966286006228cbc8fa35ac92871d"},{"version":"cc1d59cb69be74559bf501288731dfdd6b26290c683b20d0f4a0b97f1155d35a","signature":"132fd53917ed7f55275faa52c35e4d4d41e9576fea231d12740b723df2bade93"},{"version":"46dc802039939c036e50a52614744faffaf27060c6bb3a29220311368f7148c7","signature":"de2ecf9b1d6f60338f7b59b6f593ef77af9abd0e70ba8f2942953d0c6e1850af"},{"version":"602d0bbd01b7a0eb6492595cf73d2166d7b8e00fbfb7b0eb82b14e785836513c","signature":"6e503f5e906174df62cf3c7612497591a1dbb63110cdc524f0735a2016a6ad2e"},{"version":"eb9bf627ec34fa295918db1bda351063cad08bb68757a97f50e073c7c2c94da4","signature":"a3b13d166f97ae5900ad6a5b66ecdbb209378d434eca8ea6fc4d6e272b4c2472"},{"version":"c8ce89733658f16c006cf1a0e8f7afd9eaefd35833e46c59af91ee95346be98c","signature":"178e2de7a8702742957ad24deaeddec84a48cd913b5d932b16afd2a707b3e416"},{"version":"7425a64e36c402c1816a0b6aeddbc5d7c0e61b44374c81d949fc9c496ef88975","signature":"6eef4d0ee338cea465480c9cbd575df6f78d47fe0c2df1cd09fadcb7849e10cb"},"95d83d3380f931b477b8001183e8f3166db7b1d49df14466bf90693e223b82b8",{"version":"8162d174e958039d00a43ae124b4e92420f605bbbb409e4da90ebde9970c04ea","signature":"e53d21a2061c7b91944dfebec59bed2ce24ab165f984e3bae0f3a7a9f6c0458e"},{"version":"8a4ebbbdce06d6785bcfbf5cfcba1b3d05379598b9cb4770b04946dbfd30aef0","signature":"6829629d578b001051fb6dc2fb4976fbce015c04666b5a73d97335e003a75f7e"},{"version":"97ccba1e29159b5da70c069808b7d3121abe83f84cbe74d094fc1e5a37b800ac","signature":"53968130af2a091c147ddbdd9c8cfa19e083dd154584d5bef39ad25535650c35"},{"version":"58286a01aa6026d6f7c2bd248cf9af42fb1a0d7ed352becbf7a0de2f8250bb26","signature":"2b1c59d30d4fc731698e792c36c4ed4785966cc00f878c30294aa9b1b042b891"},{"version":"cd8a558b5ce73c6580fc947734e0dc4de24c551ba24a5c4b70eb90524b377378","signature":"27ca878cf70b3030e8403f51ce65949d364fa776d6dae3527f91635a40836672"},{"version":"462a03a5c9312455ef9c84127eb4fd79ba9736bbbbda4bd9f4b76e462d15c94b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"b3de90af7d32d321bba3a0769175f1d2669f13b9e6761a1258ab3a5c0840071d","signature":"d5bbd453310990e851908183fbbef9e6e2db8e0c86d97b42b723fd5238f71c81"},"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2",{"version":"172ab91e087451998f5ecf6f0f533ea89e337d24b6163defe5194899272e3df7","signature":"639f9321a98b734242a3573764d7f1de5369b0b0b10c768ae37639e8bda5dd03"},{"version":"5ba73b9bf3ca8f8c04f970c6618d5d54c3533c84f71ffb8541ded9a13b872a93","signature":"9c79ace686f720f4dd833740f7190e12cdce363362c982c164745527a412ef40"},{"version":"35c5398ee20fc33eaeed9ddc5086bfe780c41852c6ae0fd937069b991cded7d2","signature":"95e76bed30f6e993e1fcc1b90a4675682e4800ae43403547a775d6e3c7ab2b0f"},"75b22c74010ba649de1a1676a4c4b8b5bb4294fecd05089e2094429b16d7840c","4df0891b133884cd9ed752d31c7d0ec0a09234e9ed5394abffd3c660761598db","b603b62d3dcd31ef757dc7339b4fa8acdbca318b0fb9ac485f9a1351955615f9","e642bd47b75ad6b53cbf0dfd7ddfa0f120bd10193f0c58ec37d87b59bf604aca","be90b24d2ee6f875ce3aaa482e7c41a54278856b03d04212681c4032df62baf9","78f5ff400b3cb37e7b90eef1ff311253ed31c8cb66505e9828fad099bffde021","372c47090e1131305d163469a895ff2938f33fa73aad988df31cd31743f9efb6","71c67dc6987bdbd5599353f90009ff825dd7db0450ef9a0aee5bb0c574d18512","6f12403b5eca6ae7ca8e3efe3eeb9c683b06ce3e3844ccfd04098d83cd7e4957","282c535df88175d64d9df4550d2fd1176fd940c1c6822f1e7584003237f179d3","c3a4752cf103e4c6034d5bd449c8f9d5e7b352d22a5f8f9a41a8efb11646f9c2","11a9e38611ac3c77c74240c58b6bd64a0032128b29354e999650f1de1e034b1c","4ed103ca6fff9cb244f7c4b86d1eb28ce8069c32db720784329946731badb5bb","d738f282842970e058672663311c6875482ee36607c88b98ffb6604fba99cb2a","ec859cd8226aa623e41bbb47c249a55ee16dc1b8647359585244d57d3a5ed0c7","8891c6e959d253a66434ff5dc9ae46058fb3493e84b4ca39f710ef2d350656b1","c4463cf02535444dcbc3e67ecd29f1972490f74e49957d6fd4282a1013796ba6","0cb0a957ff02de0b25fd0f3f37130ca7f22d1e0dea256569c714c1f73c6791f8","2f5075dc512d51786b1ba3b1696565641dfaae3ac854f5f13d61fa12ef81a47e","ca3353cc82b1981f0d25d71d7432d583a6ef882ccdea82d65fbe49af37be51cb","50679a8e27aacf72f8c40bcab15d7ef5e83494089b4726b83eec4554344d5cdc","45351e0d51780b6f4088277a4457b9879506ee2720a887de232df0f1efcb33d8","5d697a4b315cc5bb3042ae869abffd10c3b0d7b182cda0e4c45d8819937e5796","563fa27fdaec8f195b84f71a7af0ef48d30d5cc830575db86da86a63a470c8e6","6ee58aa536dabb19b09bc036f1abe83feb51e13d63b23d30b2d0631a2de99b8f","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","299567f84bfedd1468dca2755a829cb19e607a6811673788807dc8921e211bc9","795d9fb85aad92221504db74dd179b506bd189bba0c104426f7e7bb8a66ffee5","1311bc194e0a69fe61031e852c1c0b439e2a2a3d1d5e2d8ff795499b9f283459","4b7ce19369d7e7fae76720c2c6c7f671bf3fa0f7093edb864f1ac358ca7c456c","c972ef44deca1fa8fab465915ffa00f82e126aacf3dfc8979c03b1b066ce5bb6","30285a1011c6d6b52f3ba3abb0a984be8148c05cdefb8eb6eb562335a3991f35","29c188a2c660f99f1b4835022e011c4268d7af989d4b7dda33c0a69ca1a777f8","1ed0bf138e87912d741e28333b58cbf814ae863783b3b404d2454cbabb9c5fc0","3452ee7d8ef0b1bbd47b2a56924a1dc3c79dc84a19d212e9dc496f92e4943aa0","22a21e410a4bf4817ac3b09ab90c51ec5f031edbf2e92a19b6c4832068e1f4c7","612d8ed678ed9c884c875823a72786d4820f84daff536b9ec1e4d9c829a6c66a","62c5c0c428ebac0044c4ae96900ef3da283abcdc76659ce337c720e5e92eb2f4","9bdc5cea7e3bfb096ad8ff730bfb737d922c2a83aeb5253cc1c5bd50115b0fee","55e7b39026dd9cd7b6c68be0a105b5e14063a9bdb8621d385bfb7c468ccebbbe","6963765b0ee8f9ccbcf3e6c85c0e1edc1307d9960b107368e6dff19e9170b444","b599eb810af9ddaba3d57749757c76be8f1095d3d7804984bfe879d25dc85368","e21a6a522121e5dd6c6cdf2a0d8980cd11e2ff1191c2ef05819c300fdd3b25a3","fc68efc28f7783d4756b053f6811fd63d6c4ab4717fd102c638c6471f969093e","2518ed2149cfdb36f7e9bc29561a0d1813d491e2ae78baa7cba49c578b354a27","2d2f0202995cb6116376960f788a6a0df5fe2a38b766de86632295f86d29a058","d160fe745f9c3b72d7b9036fdb2b6b500a520d43e36bb842c927b6fe59ea2c23",{"version":"5a438d8dd13b7ce91cd68cedab414e84604e0bf7c76d2cc2ad7a3207e9dda440","signature":"a17e6861b709149f29a2bd896cee94526df2f06b24a2b60614b56649b5e9aabe"},"97040b190f0daa10cf9a15e51a2fac66b26ddefd7b65998bd6027d1dd67647b7","877c25dfae100e555014e45d1d80364496a0c876201e5dea91a0fd0a6a4ff765","6c360ff81ea615810619342d67cea417bb971ada8961ac1aa86c23aff366c58f","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24",{"version":"2217890e61f53e5ac918472ee67f09d3e18b6c83986cd44c31fad5ee810ab997","signature":"23d98226adf3be74e1f0470f85e7fd154cd7aa979d60b43190a7437f0d0426eb"},{"version":"b3fb2293c781a3a174159c616d93adb55f46c915441405e8ab1ec4562fe33414","signature":"439850ca5075c6db55487b2c7fb27a6051fecbf180eee0809b67bb2783a89813"},"75d48857bc4216880443a24d985071262bb8b89a9952c77fd430cb0caa21f9bf",{"version":"3fb089f76b256567da25cced75215c7cdb7c213400848740428ce749607db7d2","signature":"33e40cf77499b3d9712db82e15683373925e85817dbe82a24ee0ee6e44bffb70"},{"version":"a910cbedfe51553a96820818e2c48f1aaa3610b5ecd65990b88c81fb46cc5be4","signature":"d53f9f96afd41359edeb2d5ad98559f3bfad261391d5aef95320fefb0c6a8742"},{"version":"c5a40716a6e879171815bebc71f2dd3bca58c790c7b20a6b8b9733b2ed58319c","signature":"16ac17bcf66fdebd02020be1b452396716134d7a281511bec775f9bec7e04200"},{"version":"7d67bee4b7f9b3390bf729b78390f5b6f8f9ce38753d8180bcfbe92845b8399d","signature":"8b206b995edc6dd849b85c1c56531b9780e3ba75302fd02a2d173f008028707e"},"e5fd6e6b32089a499bafbc66ddae09d7c3c8d7e9c4148d2fd0528ed1fe0c622a",{"version":"825778d44a20eb3346d3e818a560a58cd336505e7c22b020fae2e4c9f75f3ab8","signature":"a42c39d8b7d1b1eccb69c7919ea60dcc2670ea672a0af90b70a730974ec0e9fb"},{"version":"2728e8b5d218e1a32e0ef8f5462ecfb30861c1b3566acfffbbed2917a7ea1d98","signature":"dc5fe5f6b39c3fdfaeba333bcd5f0cc98bb3068797a4d7010f585366f549ddf7"},"2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab",{"version":"fe21efb975396ae12c2d5c30a5655e1a526718be9db1b92f3d0d5be69b2733a4","signature":"4a3ab8cb278bfd1f18f24cc45a02188b63afa6aef50035df6d79c4638f24059a"},"e724c9ce92f2a8a31ed260764c5455852a13d292e2a31d26acc6840ec0e83208","37ffe3c12813b6a6d512f7c27b71f3388d03dafa10555ad5094cea393ed3d1f6",{"version":"f2b5bdb6a68f7639e080ddfca8902b4c3cb9a73e2130494a245b151f491040a8","signature":"ed2b7ce9544f75d9aece6f8ed250b7c7048c3067de906c2c9f2e68d632b8fdcc"},{"version":"93fdd3d31ad2e6dd70a2389be7890cd88d9610e5ad782ec4bb4a9d6b6a0a9dc3","signature":"78889389420cbcbbe4146345a54cc896a88aa27fbaf759dc9235f1bc66c01a19"},"62af44d31faa5b32c9b29579330556a5340cecbd9d6326d236ed94c3d1667c2c","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3",{"version":"beb6b19b51d467d5e4f59b7c695f8f82c2e936c25680fc8e160c6feeb335e51c","signature":"c6daa2b36f9950e2ff6bb0138fc2f63a9dfd6e36c1aec88c47e7d06d6ead2d99"},{"version":"568173dcc3cf1a6238056cf96d84e1a31ea310a2a36ceb119e38cf52fb29afa2","signature":"49e2beeee0d4fe340562124e5e9a39d2afacaf567a78d08aad7226457a1aa9ae"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,436],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,181,349],[108,360,361],[108,154,345,346,347],[108,346],[108,347],[108,328,346,347,348],[108,350],[108,350,351,354,358],[108,357],[108,154,352,353],[108,154,187],[108,154,188],[108,188,189,190,191,192,193],[108,208,217,218,221],[108,208,217,220],[108,208,217,219,221],[108,209,212,213,215],[108,209,210,211],[108,212,213,215,216],[108,209,210,214],[108,220,226],[108,208,217,220,226],[108,217,220,226],[108,217,220,222,223,224,225],[108,208,217,218,219,220,221,226],[108,208,217],[108,154,366],[108,154,349,359,364,365,367],[108,154,349,359,362,363,364,366,367],[108,154,349,365],[108,154,181,366],[108,364,365,366,367,368,369,373],[108,154,194,374],[108,365,366,369],[108,154,370,371,372,374],[108,366,369],[108,154,366,369],[108,154,194,366,367],[108,154,187,194,195],[108,196],[108,115,154,196,199,200],[108,115,154,187,194,196,199],[108,200],[108,195,196,197,200,201,202,203,204],[108,115,197,199,202],[108,195,202],[108,154,194],[108,154,177],[108,177,178],[108,177,178,179,180],[108,154],[50,108,154,376],[50,108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,209],[108,298],[108,298,299],[108,355,356],[108,436,437,438,439,440],[108,436,438],[81,108,115,445],[72,108,115],[108,115,448],[108,450],[108,451,452,454],[96,108,115],[107,108,115,461],[81,108,115],[108,144],[108,467,468],[108,465,466,467],[78,81,108,115,458,459,460],[108,446,460,461,472],[108,453],[78,108,115,476],[79,108,115],[108,480],[108,486],[78,81,83,86,96,107,108,115],[108,491],[108,491,493],[108,492],[108,498,503],[108,496,499],[108,496,499,500,501],[108,498],[108,324,502],[108,497],[78,108,110,115,517,518,520],[108,519],[108,534],[108,522,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,525,526,527,528,529,530,531,532,533,534],[108,523,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,524,526,527,528,529,530,531,532,533,534],[108,522,523,524,525,527,528,529,530,531,532,533,534],[108,522,523,524,525,526,528,529,530,531,532,533,534],[108,522,523,524,525,526,527,529,530,531,532,533,534],[108,522,523,524,525,526,527,528,530,531,532,533,534],[108,522,523,524,525,526,527,528,529,531,532,533,534],[108,522,523,524,525,526,527,528,529,530,532,533,534],[108,522,523,524,525,526,527,528,529,530,531,533,534],[108,522,523,524,525,526,527,528,529,530,531,532,534],[108,522,523,524,525,526,527,528,529,530,531,532,533],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,486,544],[108,544,545,546,547,548],[108,482,483,484,485],[108,115,198],[79,108,115,477],[108,390,429],[108,390,414,429],[108,429],[108,390],[108,390,415,429],[108,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428],[108,415,429],[79,96,108,115,457],[79,81,108,115],[79,108,473],[81,108,115,471],[108,471],[108,470],[108,115,564,565,566,567,568,569,570,571,572,573,574],[108,563,564,573],[108,564,573],[108,557,563,564,573],[108,564],[71,108,563,573],[108,563,564,565,566,567,568,569,570,571,572,574],[78,81,83,96,104,107,108,113,115],[108,578],[78,96,108,115],[108,303],[108,302],[108,340],[108,340,341,342,343,344],[108,329,330,331,332,333,334,335,336,337,338,339],[108,476],[108,474,475],[108,506],[108,505,506],[108,505],[108,505,506,507,509,510,513,514,515,516],[108,506,510],[108,505,506,507,509,510,511,512],[108,505,510],[108,510,514],[108,506,507,508],[108,507],[108,505,506,510],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,115,154,182],[108,154,282],[108,251],[108,154,182,251,279,282,286,287],[108,115,154,181,182],[108,183,184,185,186,280,281],[44,50,108,279],[44,50,108,185],[108,155],[108,155,167],[108,155,156,169,171],[108,155,167,170],[108,155,161],[108,155,160,162],[108,160,161,162,163],[108,165,166],[108,156,157,158,159,164,167,168,169,170,171,172,173],[108,155,174,175,176,283],[108,155,174,282],[108,266],[108,279],[108,269,270,271,272,273,274,275,276,277],[108,154,228],[108,251,275,282],[108,228,279,282],[108,228,229,252,255,265,266,267,278],[50,108,251,284],[108,279,282],[108,227,229],[108,229],[108,282],[108,252],[108,154,255],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,264],[108,154,257],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,282],[108,154,227,228],[108,205,265],[108,154,229],[108,249],[50,108,236],[108,237,238,239,240,241,242,243,244,245,246,247,248],[108,236,249,250],[108,284],[108,154,284,288,295],[108,154,284,293,294],[108,154,284,292],[108,154,284,293,294,300],[50,108,154,284,304],[108,284,290],[108,227,284,285,307],[108,154,181,284,288],[79,108,284,311,312],[67,88,108,154,284,317],[79,87,88,108,154,284,294,314,316],[50,108,284,288,311],[108,154,284,288,294],[108,284,321],[108,284,310,311,319,321,323,327,384],[108,284,285,291,293,294,295,296,297,301,305,306,308,309,310,311,314,319,321,323,325,326,327,375,380,382,383,384,386,388,389,430],[50,108,154,284,374],[108,154,284],[50,108,284,288,294,314,382],[108,284,381],[79,88,108,154,284,288,291,316,317,320,380,381,384,432,433],[108,284,382,434],[50,108,154,227,284,285,288,305,309,326,327,375,380,384],[71,78,108,284,306],[50,108,284,288,326],[108,284,312,316,317,318,431,433,435,442],[108,284,320,381,383,384,434],[108,284,436,441],[50,108,154,284,288,289,294,297,301,374,377,378,379,381,383,384],[44,50,108,154,284,288,324,325],[50,108,154,284,294,297,319,382,383],[108,154,284,288,387],[108,284,320,380,381,383,384],[50,108,154,284,429],[108,154,284,289,291],[108,284,292],[108,284,294,315],[79,108,284,292],[288],[294],[292],[50,154,304],[227],[154,181,288],[154,294],[50,284,288,311],[310,311,319,321,323,327,384],[50,154,374],[154],[50,154,288,294,382],[145],[154,316,380,381,384],[50,154,227,288,326],[50,288,326],[312,316,317,318,431,433,435,442],[384],[50,288,374,377,381,383,384],[44,50],[50,154,294,297,319,382,383],[284,288],[79,292]],"referencedMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[285,272],[296,273],[295,274],[293,275],[297,272],[301,276],[305,277],[291,278],[306,272],[308,279],[309,272],[310,280],[313,281],[318,282],[317,283],[311,272],[319,284],[320,285],[322,286],[321,272],[385,287],[431,288],[375,289],[314,290],[383,291],[323,290],[382,292],[434,293],[435,294],[381,295],[312,296],[327,297],[443,298],[433,299],[386,290],[442,300],[380,301],[325,272],[326,302],[384,303],[388,304],[389,305],[430,306],[292,307],[294,308],[316,309],[315,310]],"exportedModulesMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[296,311],[295,312],[293,313],[301,312],[305,314],[308,315],[310,316],[317,317],[319,318],[320,312],[385,319],[431,288],[375,320],[314,321],[383,322],[323,323],[382,292],[434,324],[435,294],[381,325],[327,326],[443,327],[433,328],[380,329],[326,330],[384,331],[388,332],[389,328],[430,321],[294,308],[316,309],[315,333]],"semanticDiagnosticsPerFile":[438,436,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,360,361,362,328,348,347,346,349,351,359,358,350,354,352,188,189,190,191,192,194,193,219,221,220,208,216,212,213,217,215,222,223,224,226,225,227,218,367,366,365,364,368,374,363,370,373,371,372,369,196,197,202,200,201,205,203,204,195,178,180,179,181,177,187,307,377,376,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,211,209,210,214,299,300,298,289,355,357,356,444,441,437,439,440,353,446,447,449,452,451,455,456,462,445,463,145,464,469,465,468,467,461,473,454,453,477,478,479,450,481,487,488,489,490,448,491,492,494,495,504,496,500,502,501,499,503,498,497,519,520,466,521,535,523,524,522,525,526,527,528,529,530,531,532,533,534,536,457,537,538,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,539,540,541,484,542,460,459,543,545,547,544,546,548,549,482,486,199,198,550,551,552,553,485,414,415,390,393,412,413,403,402,400,395,408,406,410,394,407,411,396,397,409,391,398,399,401,405,416,404,392,429,428,423,425,424,417,418,420,422,426,427,419,421,458,554,555,472,470,471,556,557,558,559,518,480,560,379,561,562,575,574,565,566,567,568,569,570,571,564,572,573,563,576,577,578,579,580,118,324,304,302,303,483,432,378,339,336,338,337,335,345,340,344,341,343,342,331,332,333,329,330,334,387,474,476,475,507,516,505,506,517,512,513,511,515,509,508,514,510,290,493,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,286,182,287,288,183,184,185,282,280,186,281,155,156,157,158,159,168,169,170,172,173,171,160,162,163,161,164,165,166,167,174,284,176,175,283,228,267,269,270,278,271,272,273,274,276,275,277,268,279,252,206,207,230,231,232,233,234,235,253,254,256,265,258,257,259,260,264,261,262,263,229,266,255,250,237,246,238,239,248,240,241,249,247,242,245,243,244,251,236,285,296,295,293,297,301,305,291,306,308,309,310,313,318,317,311,319,320,322,321,385,431,375,314,383,323,382,434,435,381,312,327,443,433,386,442,380,325,326,384,388,389,430,292,294,316,315],"latestChangedDtsFile":"./types/node.d.ts"},"version":"4.8.4"} -\ No newline at end of file -+{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/superstruct/dist/error.d.ts","../../../node_modules/superstruct.d.ts","../../../node_modules/superstruct/dist/struct.d.ts","../../../node_modules/superstruct/dist/structs/coercions.d.ts","../../../node_modules/superstruct/dist/structs/refinements.d.ts","../../../node_modules/superstruct/dist/structs/types.d.ts","../../../node_modules/superstruct/dist/structs/utilities.d.ts","../../../node_modules/superstruct/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/assert.d.ts","../../../node_modules/@metamask/utils/dist/types/base64.d.ts","../../../node_modules/@metamask/utils/dist/types/hex.d.ts","../../../node_modules/@metamask/utils/dist/types/bytes.d.ts","../../../node_modules/@metamask/utils/dist/types/caip-types.d.ts","../../../node_modules/@metamask/utils/dist/types/checksum.d.ts","../../../node_modules/@metamask/utils/dist/types/coercers.d.ts","../../../node_modules/@metamask/utils/dist/types/collections.d.ts","../../../node_modules/@metamask/utils/dist/types/encryption-types.d.ts","../../../node_modules/@metamask/utils/dist/types/errors.d.ts","../../../node_modules/@metamask/utils/dist/types/json.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/@ethereumjs/common/dist/enums.d.ts","../../../node_modules/@ethereumjs/common/dist/types.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/@ethereumjs/util/dist/constants.d.ts","../../../node_modules/@ethereumjs/util/dist/units.d.ts","../../../node_modules/@ethereumjs/util/dist/address.d.ts","../../../node_modules/@ethereumjs/util/dist/bytes.d.ts","../../../node_modules/@ethereumjs/util/dist/types.d.ts","../../../node_modules/@ethereumjs/util/dist/account.d.ts","../../../node_modules/@ethereumjs/util/dist/withdrawal.d.ts","../../../node_modules/@ethereumjs/util/dist/signature.d.ts","../../../node_modules/@ethereumjs/util/dist/encoding.d.ts","../../../node_modules/@ethereumjs/util/dist/asyncEventEmitter.d.ts","../../../node_modules/@ethereumjs/util/dist/internal.d.ts","../../../node_modules/@ethereumjs/util/dist/lock.d.ts","../../../node_modules/@ethereumjs/util/dist/provider.d.ts","../../../node_modules/@ethereumjs/util/dist/index.d.ts","../../../node_modules/@ethereumjs/common/dist/common.d.ts","../../../node_modules/@ethereumjs/common/dist/utils.d.ts","../../../node_modules/@ethereumjs/common/dist/index.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip2930Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/legacyTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/types.d.ts","../../../node_modules/@ethereumjs/tx/dist/baseTransaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/eip1559Transaction.d.ts","../../../node_modules/@ethereumjs/tx/dist/transactionFactory.d.ts","../../../node_modules/@ethereumjs/tx/dist/index.d.ts","../../../node_modules/@metamask/utils/dist/types/keyring.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@metamask/utils/dist/types/logging.d.ts","../../../node_modules/@metamask/utils/dist/types/misc.d.ts","../../../node_modules/@metamask/utils/dist/types/number.d.ts","../../../node_modules/@metamask/utils/dist/types/opaque.d.ts","../../../node_modules/@metamask/utils/dist/types/promise.d.ts","../../../node_modules/@metamask/utils/dist/types/time.d.ts","../../../node_modules/@metamask/utils/dist/types/transaction-types.d.ts","../../../node_modules/@metamask/utils/dist/types/versions.d.ts","../../../node_modules/@metamask/utils/dist/types/index.d.ts","../../snaps-sdk/dist/types/jsx/component.d.ts","../../snaps-sdk/dist/types/jsx/components/Address.d.ts","../../snaps-sdk/dist/types/jsx/components/Box.d.ts","../../snaps-sdk/dist/types/jsx/components/Copyable.d.ts","../../snaps-sdk/dist/types/jsx/components/Divider.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Button.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Input.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Field.d.ts","../../snaps-sdk/dist/types/jsx/components/form/Form.d.ts","../../snaps-sdk/dist/types/jsx/components/form/index.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Bold.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/Italic.d.ts","../../snaps-sdk/dist/types/jsx/components/formatting/index.d.ts","../../snaps-sdk/dist/types/jsx/components/Heading.d.ts","../../snaps-sdk/dist/types/jsx/components/Image.d.ts","../../snaps-sdk/dist/types/jsx/components/Link.d.ts","../../snaps-sdk/dist/types/jsx/components/Text.d.ts","../../snaps-sdk/dist/types/jsx/components/Row.d.ts","../../snaps-sdk/dist/types/jsx/components/Spinner.d.ts","../../snaps-sdk/dist/types/jsx/components/index.d.ts","../../snaps-sdk/dist/types/jsx/jsx-runtime.d.ts","../../snaps-sdk/dist/types/jsx/jsx-dev-runtime.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/utils.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/classes.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/errors.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/error-constants.d.ts","../../../node_modules/@metamask/rpc-errors/dist/types/index.d.ts","../../snaps-sdk/dist/types/errors.d.ts","../../snaps-sdk/dist/types/internals/error-wrappers.d.ts","../../snaps-sdk/dist/types/internals/errors.d.ts","../../snaps-sdk/dist/types/internals/helpers.d.ts","../../snaps-sdk/dist/types/internals/structs.d.ts","../../../node_modules/@metamask/safe-event-emitter/dist/cjs/index.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/JsonRpcEngine.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createAsyncMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/createScaffoldMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/getUniqueId.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/idRemapMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/mergeMiddleware.d.ts","../../../node_modules/@metamask/json-rpc-engine/dist/types/index.d.ts","../../../node_modules/@metamask/providers/dist/types/utils.d.ts","../../../node_modules/@metamask/providers/dist/types/BaseProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/EIP6963.d.ts","../../../node_modules/@types/readable-stream/node_modules/safe-buffer/index.d.ts","../../../node_modules/@types/readable-stream/index.d.ts","../../../node_modules/@metamask/providers/dist/types/StreamProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/extension-provider/createExternalExtensionProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts","../../../node_modules/@metamask/providers/dist/types/shimWeb3.d.ts","../../../node_modules/@metamask/providers/dist/types/index.d.ts","../../snaps-sdk/dist/types/types/methods/create-interface.d.ts","../../snaps-sdk/dist/types/types/methods/dialog.d.ts","../../../node_modules/@metamask/key-tree/dist/constants.d.cts","../../../node_modules/@noble/curves/abstract/modular.d.ts","../../../node_modules/@noble/curves/abstract/utils.d.ts","../../../node_modules/@noble/curves/abstract/curve.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/ed25519Bip32.d.cts","../../../node_modules/@noble/curves/abstract/weierstrass.d.ts","../../../node_modules/@metamask/key-tree/dist/curves/secp256k1.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/curve.d.cts","../../../node_modules/@metamask/key-tree/dist/curves/index.d.cts","../../../node_modules/@metamask/key-tree/dist/utils.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44CoinTypeNode.d.cts","../../../node_modules/@metamask/key-tree/dist/SLIP10Node.d.cts","../../../node_modules/@metamask/key-tree/dist/BIP44Node.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip32.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/bip39.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/cip3.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/slip10.d.cts","../../../node_modules/@metamask/key-tree/dist/derivers/index.d.cts","../../../node_modules/@metamask/key-tree/dist/index.d.cts","../../snaps-sdk/dist/types/types/caip.d.ts","../../snaps-sdk/dist/types/types/permissions.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip32-public-key.d.ts","../../snaps-sdk/dist/types/types/methods/get-bip44-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-client-status.d.ts","../../snaps-sdk/dist/types/types/methods/get-entropy.d.ts","../../snaps-sdk/dist/types/types/methods/get-file.d.ts","../../snaps-sdk/dist/types/ui/nodes.d.ts","../../snaps-sdk/dist/types/ui/components/address.d.ts","../../snaps-sdk/dist/types/ui/components/copyable.d.ts","../../snaps-sdk/dist/types/ui/components/divider.d.ts","../../snaps-sdk/dist/types/ui/components/heading.d.ts","../../snaps-sdk/dist/types/ui/components/image.d.ts","../../snaps-sdk/dist/types/ui/components/panel.d.ts","../../snaps-sdk/dist/types/ui/components/spinner.d.ts","../../snaps-sdk/dist/types/ui/components/text.d.ts","../../snaps-sdk/dist/types/ui/components/row.d.ts","../../snaps-sdk/dist/types/ui/components/button.d.ts","../../snaps-sdk/dist/types/ui/components/input.d.ts","../../snaps-sdk/dist/types/ui/components/form.d.ts","../../snaps-sdk/dist/types/ui/components/index.d.ts","../../snaps-sdk/dist/types/ui/component.d.ts","../../snaps-sdk/dist/types/ui/index.d.ts","../../snaps-sdk/dist/types/types/interface.d.ts","../../snaps-sdk/dist/types/types/methods/get-interface-state.d.ts","../../snaps-sdk/dist/types/types/methods/get-locale.d.ts","../../snaps-sdk/dist/types/types/snap.d.ts","../../snaps-sdk/dist/types/types/methods/get-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-snap.d.ts","../../snaps-sdk/dist/types/types/methods/invoke-keyring.d.ts","../../snaps-sdk/dist/types/types/methods/manage-accounts.d.ts","../../snaps-sdk/dist/types/types/methods/manage-state.d.ts","../../snaps-sdk/dist/types/types/methods/notify.d.ts","../../snaps-sdk/dist/types/types/methods/request-snaps.d.ts","../../snaps-sdk/dist/types/types/methods/update-interface.d.ts","../../snaps-sdk/dist/types/types/methods/methods.d.ts","../../snaps-sdk/dist/types/types/methods/index.d.ts","../../snaps-sdk/dist/types/types/provider.d.ts","../../snaps-sdk/dist/types/types/global.d.ts","../../snaps-sdk/dist/types/types/images.d.ts","../../snaps-sdk/dist/types/types/handlers/cronjob.d.ts","../../snaps-sdk/dist/types/types/handlers/home-page.d.ts","../../snaps-sdk/dist/types/types/handlers/keyring.d.ts","../../snaps-sdk/dist/types/types/handlers/lifecycle.d.ts","../../snaps-sdk/dist/types/types/handlers/name-lookup.d.ts","../../snaps-sdk/dist/types/types/handlers/rpc-request.d.ts","../../snaps-sdk/dist/types/types/handlers/transaction.d.ts","../../snaps-sdk/dist/types/types/handlers/signature.d.ts","../../snaps-sdk/dist/types/types/handlers/user-input.d.ts","../../snaps-sdk/dist/types/types/handlers/index.d.ts","../../snaps-sdk/dist/types/types/index.d.ts","../../snaps-sdk/dist/types/internals/jsx.d.ts","../../snaps-sdk/dist/types/internals/svg.d.ts","../../snaps-sdk/dist/types/internals/index.d.ts","../../snaps-sdk/dist/types/jsx/validation.d.ts","../../snaps-sdk/dist/types/jsx/index.d.ts","../src/array.ts","../../snaps-sdk/dist/types/error-wrappers.d.ts","../../snaps-sdk/dist/types/images.d.ts","../../snaps-sdk/dist/types/index.d.ts","../../../node_modules/@scure/base/lib/index.d.ts","../../../node_modules/rfdc/index.d.ts","../src/deep-clone.ts","../src/virtual-file/VirtualFile.ts","../src/bytes.ts","../src/virtual-file/index.ts","../src/base64.ts","../src/auxiliary-files.ts","../src/caveats.ts","../../../node_modules/@noble/hashes/utils.d.ts","../../../node_modules/@noble/hashes/_md.d.ts","../../../node_modules/@noble/hashes/sha256.d.ts","../src/checksum.ts","../../../node_modules/cron-parser/types/common.d.ts","../../../node_modules/cron-parser/types/index.d.ts","../../../node_modules/cron-parser/index.d.ts","../src/cronjob.ts","../src/default-endowments.ts","../../../node_modules/@metamask/slip44/slip44.json","../src/derivation-paths.ts","../src/entropy.ts","../src/errors.ts","../src/handler-types.ts","../src/mock.ts","../src/eval-worker.ts","../src/json.ts","../src/virtual-file/toVirtualFile.ts","../src/virtual-file/node.ts","../src/fs.ts","../src/eval.ts","../src/handlers.ts","../src/icon.ts","../src/iframe.ts","../src/iframe.test.browser.ts","../src/logging.ts","../../../node_modules/chalk/index.d.ts","../src/strings.ts","../src/structs.ts","../src/namespace.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV1.d.ts","../../../node_modules/immer/dist/utils/env.d.ts","../../../node_modules/immer/dist/utils/errors.d.ts","../../../node_modules/immer/dist/types/types-external.d.ts","../../../node_modules/immer/dist/types/types-internal.d.ts","../../../node_modules/immer/dist/utils/common.d.ts","../../../node_modules/immer/dist/utils/plugins.d.ts","../../../node_modules/immer/dist/core/scope.d.ts","../../../node_modules/immer/dist/core/finalize.d.ts","../../../node_modules/immer/dist/core/proxy.d.ts","../../../node_modules/immer/dist/core/immerClass.d.ts","../../../node_modules/immer/dist/core/current.d.ts","../../../node_modules/immer/dist/internal.d.ts","../../../node_modules/immer/dist/plugins/es5.d.ts","../../../node_modules/immer/dist/plugins/patches.d.ts","../../../node_modules/immer/dist/plugins/mapset.d.ts","../../../node_modules/immer/dist/plugins/all.d.ts","../../../node_modules/immer/dist/immer.d.ts","../../../node_modules/@metamask/base-controller/dist/types/RestrictedControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/ControllerMessenger.d.ts","../../../node_modules/@metamask/base-controller/dist/types/BaseControllerV2.d.ts","../../../node_modules/@metamask/base-controller/dist/types/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/types.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/constants.d.ts","../../../node_modules/@metamask/eth-query/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/util.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/abnf.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/utils.d.ts","../../../node_modules/@spruceid/siwe-parser/dist/parsers.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/siwe.d.ts","../../../node_modules/@metamask/controller-utils/dist/types/index.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/ApprovalController.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/approval-controller/dist/types/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/permission-middleware.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/SubjectMetadataController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/PermissionController.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Permission.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/Caveat.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/errors.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/utils.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/getPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/requestPermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/revokePermissions.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/rpc-methods/index.d.ts","../../../node_modules/@metamask/permission-controller/dist/types/index.d.ts","../src/json-rpc.ts","../../../node_modules/@metamask/snaps-registry/dist/verify.d.ts","../../../node_modules/@metamask/snaps-registry/dist/index.d.ts","../../../node_modules/fast-json-stable-stringify/index.d.ts","../../../node_modules/@types/validate-npm-package-name/index.d.ts","../src/snaps.ts","../src/manifest/validation.ts","../src/manifest/index.ts","../src/localization.ts","../src/types.ts","../src/index.executionenv.ts","../src/path.ts","../../../node_modules/marked/lib/marked.d.ts","../src/ui.tsx","../src/validation.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../src/versions.ts","../src/index.ts","../../../node_modules/fast-deep-equal/index.d.ts","../src/npm.ts","../src/manifest/manifest.ts","../src/manifest/node.ts","../../../node_modules/@babel/types/lib/index.d.ts","../../../node_modules/@types/babel__generator/index.d.ts","../../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/@types/babel__template/index.d.ts","../../../node_modules/@types/babel__traverse/index.d.ts","../../../node_modules/@types/babel__core/index.d.ts","../src/post-process.ts","../src/node.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/body-parser/index.d.ts","../../../node_modules/@types/bonjour/index.d.ts","../../../node_modules/@types/insert-module-globals/index.d.ts","../../../node_modules/@types/browserify/index.d.ts","../../../node_modules/@types/har-format/index.d.ts","../../../node_modules/@types/chrome/har-format/index.d.ts","../../../node_modules/@types/chrome/chrome-cast/index.d.ts","../../../node_modules/@types/filewriter/index.d.ts","../../../node_modules/@types/filesystem/index.d.ts","../../../node_modules/@types/chrome/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/mime/index.d.ts","../../../node_modules/@types/send/index.d.ts","../../../node_modules/@types/range-parser/index.d.ts","../../../node_modules/@types/qs/index.d.ts","../../../node_modules/@types/express-serve-static-core/index.d.ts","../../../node_modules/@types/connect-history-api-fallback/index.d.ts","../../../node_modules/@types/convert-source-map/index.d.ts","../../../node_modules/@types/deep-freeze-strict/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/Mime.d.ts","../../../node_modules/@types/serve-static/node_modules/@types/mime/index.d.ts","../../../node_modules/@types/serve-static/index.d.ts","../../../node_modules/@types/express/index.d.ts","../../../node_modules/minimatch/dist/cjs/escape.d.ts","../../../node_modules/minimatch/dist/cjs/unescape.d.ts","../../../node_modules/minimatch/dist/cjs/index.d.ts","../../../node_modules/@types/glob/index.d.ts","../../../node_modules/@types/graceful-fs/index.d.ts","../../../node_modules/@types/gunzip-maybe/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/react/ts5.0/global.d.ts","../../../node_modules/csstype/index.d.ts","../../../node_modules/@types/prop-types/index.d.ts","../../../node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/@types/react/ts5.0/index.d.ts","../../../node_modules/@types/hoist-non-react-statics/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/http-proxy/index.d.ts","../../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../../node_modules/@types/istanbul-lib-report/index.d.ts","../../../node_modules/source-map/source-map.d.ts","../../../node_modules/@types/istanbul-lib-source-maps/index.d.ts","../../../node_modules/@types/istanbul-reports/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../node_modules/@types/jest/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/@types/jest/index.d.ts","../../../node_modules/parse5/dist/common/html.d.ts","../../../node_modules/parse5/dist/common/token.d.ts","../../../node_modules/parse5/dist/common/error-codes.d.ts","../../../node_modules/parse5/dist/tokenizer/preprocessor.d.ts","../../../node_modules/parse5/dist/tokenizer/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/interface.d.ts","../../../node_modules/parse5/dist/parser/open-element-stack.d.ts","../../../node_modules/parse5/dist/parser/formatting-element-list.d.ts","../../../node_modules/parse5/dist/parser/index.d.ts","../../../node_modules/parse5/dist/tree-adapters/default.d.ts","../../../node_modules/parse5/dist/serializer/index.d.ts","../../../node_modules/parse5/dist/common/foreign-content.d.ts","../../../node_modules/parse5/dist/index.d.ts","../../../node_modules/@types/tough-cookie/index.d.ts","../../../node_modules/@types/jsdom/base.d.ts","../../../node_modules/@types/jsdom/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/lodash.mergewith/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/prettier/index.d.ts","../../../node_modules/@types/punycode/index.d.ts","../../../node_modules/@types/react-dom/index.d.ts","../../../node_modules/@types/react-transition-group/Transition.d.ts","../../../node_modules/@types/react-transition-group/CSSTransition.d.ts","../../../node_modules/@types/react-transition-group/TransitionGroup.d.ts","../../../node_modules/@types/react-transition-group/SwitchTransition.d.ts","../../../node_modules/@types/react-transition-group/config.d.ts","../../../node_modules/@types/react-transition-group/index.d.ts","../../../node_modules/@types/resolve/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/rimraf/index.d.ts","../../../node_modules/@types/scheduler/index.d.ts","../../../node_modules/@types/serve-handler/index.d.ts","../../../node_modules/@types/serve-index/index.d.ts","../../../node_modules/@types/sockjs/index.d.ts","../../../node_modules/@types/source-list-map/index.d.ts","../../../node_modules/@types/stack-utils/index.d.ts","../../../node_modules/@types/tar-stream/index.d.ts","../../../node_modules/@types/use-sync-external-store/index.d.ts","../../../node_modules/@types/warning/index.d.ts","../../../node_modules/@types/webpack-env/index.d.ts","../../../node_modules/@types/webpack-sources/node_modules/source-map/source-map.d.ts","../../../node_modules/@types/webpack-sources/lib/Source.d.ts","../../../node_modules/@types/webpack-sources/lib/CompatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ConcatSource.d.ts","../../../node_modules/@types/webpack-sources/lib/OriginalSource.d.ts","../../../node_modules/@types/webpack-sources/lib/PrefixSource.d.ts","../../../node_modules/@types/webpack-sources/lib/RawSource.d.ts","../../../node_modules/@types/webpack-sources/lib/ReplaceSource.d.ts","../../../node_modules/@types/webpack-sources/lib/SizeOnlySource.d.ts","../../../node_modules/@types/webpack-sources/lib/SourceMapSource.d.ts","../../../node_modules/@types/webpack-sources/lib/index.d.ts","../../../node_modules/@types/webpack-sources/lib/CachedSource.d.ts","../../../node_modules/@types/webpack-sources/index.d.ts","../../../node_modules/@types/which/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"3260e3386d9535b804205bdddb5618a9a27735bd22927f48ad54363abcd23d45","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"e475453e7140e95542332943d3052fe4c7430ad1efce42b3e9157f1fee8cbc5f","ebfdf904255ce746c9d30117c2edef355fb19bf7650478d2405f39f0e4f302e6","f3f63b48addb8e2ea9d20bb671c3c306413b3daa39996d0ae52f63d8e32158e1","a50599c08934a62f11657bdbe0dc929ab66da1b1f09974408fd9a33ec1bb8060","5a20e7d6c630b91be15e9b837853173829d00273197481dc8d3e94df61105a71","8d478048d71cc16f806d4b71b252ecb67c7444ccf4f4b09b29a312712184f859","b4000a0a525fa921e896cbdb32ae802c9684f0fd371b5fc69e7310f7918cc2c3","9df4662ca3dbc2522bc115833ee04faa1afbb4e249a85ef4a0a09c621346bd08","b25d9065cf1c1f537a140bbc508e953ed2262f77134574c432d206ff36f4bdbf","1b103313097041aa9cd705a682c652f08613cb5cf8663321061c0902f845e81c","68ccec8662818911d8a12b8ed028bc5729fb4f1d34793c4701265ba60bc73cf4","5f85b8b79dc4d36af672c035b2beb71545de63a5d60bccbeee64c260941672ab","b3d48529ae61dc27d0bfbfa2cb3e0dff8189644bd155bdf5df1e8e14669f7043","40fe4b689225816b31fe5794c0fbf3534568819709e40295ead998a2bc1ab237","f65b5e33b9ad545a1eebbd6afe857314725ad42aaf069913e33f928ab3e4990a","fb6f2a87beb7fb1f4c2b762d0c76a9459fc91f557231569b0ee21399e22aa13d","31c858dc85996fac4b7fa944e1016d5c72f514930a72357ab5001097bf6511c7","3de30a871b3340be8b679c52aa12f90dd1c8c60874517be58968fdbcc4d79445","6fd985bd31eaf77542625306fb0404d32bff978990f0a06428e5f0b9a3b58109","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"02873d070f9cb79f50833fbf4a9a27ac578a2edf8ddb8421eba1b37faba83bfb","affectsGlobalScope":true},"11e2d554398d2bd460e7d06b2fa5827a297c8acfbe00b4f894a224ac0862857f",{"version":"a8c260f87bca4da5d28dbc255c17656831e64d173a6cbbc2748e5cc12b77731c","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5eb881ed2a0d5b17ea36df5cd4c4be500e460c412f270c3170e906bec65580ac","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e630e5528e899219ae319e83bef54bf3bcb91b01d76861ecf881e8e614b167f0","affectsGlobalScope":true},"2c45b35f4850881ab132f80d3cb51e8a359a4d8fafdc5ff2401d260dc27862f4","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","3163f47436da41706c6e2b3c1511f3b7cce9f9f3905b2f3e01246c48b4ba7d14","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","09326ae5f7e3d49be5cd9ea00eb814770e71870a438faa2efd8bdd9b4db21320",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","c4577fb855ca259bdbf3ea663ca73988ce5f84251a92b4aef80a1f4122b6f98e","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"ff07a9a03c65732ccc59b3c65bc584173da093bd563a6565411c01f5703bd3cb","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","175323e2a79a6076e0bada8a390d535a3ea817158bf1b1f46e31efca9028a0a2","7a10053aadc19335532a4d02756db4865974fd69bea5439ddcc5bfdf062d9476","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","aed9e712a9b168345362e8f3a949f16c99ca1e05d21328f05735dfdbb24414ef","b04fe6922ed3db93afdbd49cdda8576aa75f744592fceea96fb0d5f32158c4f5","ed8d6c8de90fc2a4faaebc28e91f2469928738efd5208fb75ade0fa607e892b7","d7c52b198d680fe65b1a8d1b001f0173ffa2536ca2e7082431d726ce1f6714cd","c07f251e1c4e415a838e5498380b55cfea94f3513229de292d2aa85ae52fc3e9","0ed401424892d6bf294a5374efe512d6951b54a71e5dd0290c55b6d0d915f6f7","b945be6da6a3616ef3a250bfe223362b1c7c6872e775b0c4d82a1bf7a28ff902","beea49237dd7c7110fabf3c7509919c9cb9da841d847c53cac162dc3479e2f87","0f45f8a529c450d8f394106cc622bff79e44a1716e1ac9c3cc68b43f7ecf65ee","c624ce90b04c27ce4f318ba6330d39bde3d4e306f0f497ce78d4bda5ab8e22ca","9b8253aa5cb2c82d505f72afdbf96e83b15cc6b9a6f4fadbbbab46210d5f1977","86a8f52e4b1ac49155e889376bcfa8528a634c90c27fec65aa0e949f77b740c5","aab5dd41c1e2316cc0b42a7dd15684f8582d5a1d16c0516276a2a8a7d0fecd9c","59948226626ee210045296ba1fc6cb0fe748d1ff613204e08e7157ab6862dee7","ec3e54d8b713c170fdc8110a7e4a6a97513a7ab6b05ac9e1100cb064d2bb7349","43beb30ecb39a603fde4376554887310b0699f25f7f39c5c91e3147b51bb3a26","666b77d7f06f49da114b090a399abbfa66d5b6c01a3fd9dc4f063a52ace28507","31997714a93fbc570f52d47d6a8ebfb021a34a68ea9ba58bbb69cdec9565657e","6032e4262822160128e644de3fc4410bcd7517c2f137525fd2623d2bb23cb0d3","8bd5c9b1016629c144fd228983395b9dbf0676a576716bc3d316cab612c33cd5","2ed90bd3925b23aed8f859ffd0e885250be0424ca2b57e9866dabef152e1d6b7","93f6bd17d92dab9db7897e1430a5aeaa03bcf51623156213d8397710367a76ce","3f62b770a42e8c47c7008726f95aa383e69d97e85e680d237b99fcb0ee601dd8","5b84cfe78028c35c3bb89c042f18bf08d09da11e82d275c378ae4d07d8477e6c","980d21b0081cbf81774083b1e3a46f4bbdcd2b68858df0f66d7fad9c82bc34bc","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","b17f3bb7d8333479c7e45e5f3d876761b9bca58f97594eca3f6a944fd825e632","3c1f1236cce6d6e0c4e2c1b4371e6f72d7c14842ecd76a98ed0748ee5730c8f3","6d7f58d5ea72d7834946fd7104a734dc7d40661be8b2e1eaced1ddce3268ebaf","4c26222991e6c97d5a8f541d4f2c67585eda9e8b33cf9f52931b098045236e88","277983d414aa99d78655186c3ee1e1c38c302e336aff1d77b47fcdc39d8273fe","47383b45796d525a4039cd22d2840ac55a1ff03a43d027f7f867ba7314a9cf53","6548773b3abbc18de29176c2141f766d4e437e40596ee480447abf83575445ad","6ddd27af0436ce59dd4c1896e2bfdb2bdb2529847d078b83ce67a144dff05491","816264799aef3fd5a09a3b6c25217d5ec26a9dfc7465eac7d6073bcdc7d88f3f","c467dada8fea6d60dff8a8be2675f737cacc76e14e50b72daa0f0710376df84b","9cb80bba611c2dd155a446ce424fe4bb1df2129751bc9416b7e42c055d1ddbff","44f41abb29bf3f4c52270d8119a96c935131e42a9186da15216a76b35e793b4e","043783bebe87efb440183c9ebc8c4fdc1bb92060a5a0f7ce847e30dee7013ac3","e3dc0a97a59dea936b4fb7b1f6f4117b4aac9c86d0cd08b69bab2d0532a8a5e3","5d897601f8a4fe913057019d8211b99b06e3138f625a0cfb601d074f4278271d","cfde5d194dd858ad68f910defaed5b0d28730f8bf38359a9265a93ab29bc7bef","16b21bbe6ad41019c071677877b8fc5dbc8d39a8b0406f020261c5f6f3894be3","f20aae41b169cddcbf3fde8ac380443182c8d7225194e788c404d9e11e6dc75d","87fd9a98cb1e689320ab89adc65e85d140a61260b4f66d12c777f4bd7cae2060","c48566cb13403fca44192b4528e3f2ac993869d39526bd42cd2f2167c0285add","efae20e0c581240c7522e04829da4f0453ca263068596554d4b0e27878c7dfac","3af68ef927788cda7daab34be513fa4508229fdc6e5130d564a0a1ccb3fefafe","bbbd2cbb15a37d5f4dd54ad8c7c537d3df8352117523030fcec7dcbe62a05a58","b50d24ebc117f8805332e7e260e9587f572bb7b2ff0ca1ff6cfafb38015781f3","5cc8b8e18fe7fefab4b3c53a39467b5a0deb4200abae7f063ff0624b9e856c51","8e990781eb0107c25429b1274a31a4f3866a9a46290cce40f354b2a6e71c6c21","8616706e4bd72987bd86c1b4afafa90fa2d4ef2f71708de03a823ab4e9b48e60","b9ce4613536386a98897f1e3d8f61a851ce6cb34dc3c9db4f2ef5f55f007e9e1","77fe56751d7615743937268c72d797fba28309f13ec9079c018b232040fca86a","31b5f53e3d57470830e87f9e03c02d4569ac81d4a758fdda75092f9a3f58beba","d765fbab22fd7003a65ed670100362ec1c90d55a772e6773a774135594e7ea41","9f9e5bae412fa5909fae636d6733aee27a108cc2ed5b13980611016336774d3c","662fe197bba64bd3f17ee118058cd2d0d2dbe33d7c0c865fd6365d90bfc44e1e","030519c351f800551cac2658038804969ca4584d2c0175a710602ac234ca1340","0278a6939ca83cd040b08ff8c5fc7838b6693ddc52f22526bf158e6b10e0246c","c2d6206e5ba4fd3063b01218c2b3b997afc1cfbeb49fcee991fa8595842ce53d","6a8096993458a3d71229031aa7415974eb5b47b320213e29660adfb519d6a3f4","cb7996a1af5b1d276483cd0c9b9de6540eff021abc90a720511ff4464519a2ff","9df6ec68878d65bc690ea3a33ce3ef5aa8254c36bc5f8346c0c2fd1f3b88a35c","a4fad04c4acc8a4b195cbbccef4c55019104753d547d5c94441643ccc89108a0","0244c23ea642361f7c192c1f0cfff9c12cfa5f51f9b155edd5c0a89fef308d34","fcc8beef29f39f09b1d9c9f99c42f9fed605ab1c28d2a630185f732b9ba53763","8b497c8cdd875848164f60712378fb15fbc2d625b67d29285845a51fcca57aff","0be91c7eb27de7e2b84c2caa3f89ac2c314de7e00d142c01b3baa0c88163bba4","0a0658c71cfa72984205a2f33b1e28e5e5fdbce0e4fb88186aed4e5a658065dc","cb047832dc68f5a2c41c62c5e95ddcacbae3a8b034d40cd15319a8cb7f25104a","980336ccdfc3c08f3c3b201aa6662e6016e20f15847f8465b68f3e8e67b4665c","5a3493939995f46ff3d9073cd534fb8961c3bf4e08c71db27066ff03d906dea8","bb5a2ac327605ebebf831c469b05bd34a33a6a46ee8c1edd9f3310aad32cf6a1","d1f010c19eb9c8190bd0859fa3b6f4975543b912b8b85e20bbb0b5bfbdf4d2b3","de4ccc96cef3f97fab148640799abb32a24b567a902a8233913f98481e3131bf",{"version":"801934aa449fe6df584bccdcc5d5b9280295cb7ac84918b6014fc5086e6f9ff6","affectsGlobalScope":true},"5e379df3d61561c2ed7789b5995b9ba2143bbba21a905e2381e16efe7d1fa424","f07a137bbe2de7a122c37bfea00e761975fb264c49f18003d398d71b3fb35a5f","6af760fb9ea02dc807c5053d8aee86389c4fce72fbb26af7b9568cac6c4710d5","c62c4ba5e910b4523f7e7adf4a55ec45c2bac99d9d8e9b0fe0c2a800a6f641b9","92131434f876fdd6fcbc40bd54a9d7500c66974362b16bd42641f990468587f4","8cf023c0bd57992fdd2ce6a7030a1874f49c8edc62eaffa9bfffcf18d2a2a1a2","8ea8f3040e38fb50d7dc3653f3b8a0dbb5244e82111576f99ce096bdc0fbf94c","48ed788ad126545a6156fcc37cd3bcf17de18a3e3fe6b6ef62cfb8140d1a45a2","ac5da520487547013c3abae0933d6366f51db6df31d1993ddb931ce04b083269","3c69a83bde847af6fc3a53e1bb6b13cd06d38a27a142814b8dacc374f3b93284","5b46f7113f54565e7ffc83f2b474f557a1f54c7e5946769d5be220454656be73","fb58035d39c5759283cb73cfb3548aefe370aa3ad4e81fdb4e46f0979eb7669f","44412cd78df82b6698ea95aa28b4df68a2962fb84e66802802f58f11e2658d96","d0b3609e8e7afed0fd0570152255458407e67249b94f6603afdfd68599423f21","17f4c5a1d6eaa87ea27eadcdff9085af3190533d98f799dda79a3af6f9a630ea","3e6f734ddf40e2e99ff7fff9568b7d9720663af9a0632c26a352c8d3270a3f0e","628bc7c0dd29c0ce9faf446e606e16b2d31930f7d96c7a1a050034859bac9756","a3fc57dbaa7f1efb010399ad4ef4fd9b462aa4e93bf74a9a34b099b97ffcc9cb","ffddd7ec6a450b0cb6f2f73f80de1df963ead312d7c81a8440268f34146ecb87","5d6a36ca0087fd6876df654d1b4192f0e402adfde994ad47e5c065da33692f9c","eb157a09c5f543d98644e2a99a785f9e0e91f054f9fecbf1c3e15831ff5d63a7","edd5530e2b1ccdf65093296e40a8634fcb11ecda3c164c31383a8c34cb04bc9d","9dfaf96d090fe8d96143465d85b4837661ae535143eea9ef99cd20df2e66338e","209d45c27e03c1417c42985252de6c25a2ec23abdc199d88e6139c88b93abd11","0ee5cdba58cfde3012bb9ff2e9edcc4e35a651373a2aa2c83ff9eb7df635419a","540f4dca27ea5a232828b6d91e1b2fce2720bdabaa4c1f3fbf59b672cc58bd8a","ba086b99d545ec6c9ff356989f076b5652ea1b09bcc65b87dfc43a5195a2efcc","c85d9776b36166b928ab1488d9224ebf970d41b0a35f09a3ee0b9bee3e698061","683196f606c5dab1c8c4a24a66d26e00f16f2d4b2a5abe25ebedd37d2954f930","9c3a1b01cba1238fb723ce06b6c163ef6c53be755394406782564d5c42c636b2","6e795e6270d39e918c7a0e62ac73793cda06fcf4b3692ee46583e15f5bf57ab8","0e821ef1eb67fa6144ea4de4277d913f5b1982d7407afd5f93754a8239d41554","5c09195ef359ffa9c6bbdb4fefb101d87ede4b9e9c28213faf5b45d102e4c609","80b4d93a4dcc90a12f6f4bb7c6851a8182ae29e556716d0d80b5c012a5ef554a","2556ef9d1820e0b6bbca6dd65a50ea64f525c4d8247ab50dff44c3f0d14a5643","cbd1c836db190d6e3add07165afc228f04e1f6170e1fe3aa5e6fc24a7e9573a3","9b13881feb958237232586d888a10a39d47cdffe3ee34688ed41888fa7baad94","122fe82cf5af80f0b26832b258b537b7dfe3ec28449c301b259ab10204b50d45","f75cd30f162c2af5e5aca39c01c1a521bfa034fae523793de872815a3468bc08","0cf1123db73dabd86466a462375a6addae52f58d23030c6033f8aadc23539a36","e29cef4158591ed213b1c2cba8988237b1ff369f7a6ecd8cb8ac0302bad1fba8","5307876e4d0021ea01235eb2f7c24671f3d8b37590f4b446cd132a4e1dc9a335","92550acd737790dc60c4c130e6aac78656dd48a8334a4882f40e7f86bdf7a590","3df821880914f8bb3c8107b1107be75c8ddbe2120a2cefabbaf9b65936b5f4dd","20626e4260b7d621745b2e78e883d9de7cc94ec346ef13344dd96eb479813870","078b7043bea0968860374bf4671ed74dd9f6be4e28ab659517d81f74be463c51","68b139ebb9a7f3ee4ded6286d74f978a47968727665120f3bfc560476ce33c4d","56d02c29b2fd39b1b1a1265df291f3f98e6ec3e6119aff9f4cfa44fe888efaa7","2d01884891da6495cb4a2f060e4898209a507e711464c4c1480df85264e863ed","620eb3b3aafe33839ee0f50e2cb237450f066fd88c8367cd15d75d02f7c9146f","6a5a3a7ae4e448668f8986632d2b6adfeebfdc06b0f9256f35c10ec148fa01f0","080b1aa93227952b4dd74b9d2c6e4f6002eb8403533749116a1c53bb9961c02d","874087eec1d457f6e3baf5ac46c42ea200e55040b394fac667aa3a64c49f5f6c","6e8a5b04a18abb192abc89d7219b9c6f633cb3136777ec808673a65f111ca749","6db505486e882a6688c5525cb65f6f06d3c5f16f03f329fbdec01dd379c97f96","d74d2a92b54f95e47d2b76bd5ee516aab7ae93afb79cd34c6681dd29eb09e72a","747e6326a724bc54f799a466a5b5c4978a601a04a063a5bdabe150af2f25b9e2","b57e22e53b56cca7a57bfcfb234aa6a66f9b9e4c07159d7388f94f17a3eaee2c","e47709ec4d1618ef429648cd8ef967aef2005526b34fcbfac33037add347dc71","b81abb3e47fbbb3af41fa75bada89bbcfa4b0feed9a0d6d4b19ed1ce1033b53c","15b330546e9784461058e5fd6e2346bf272140fa6f0cda34e193ae501d8b17b1","4d8ce72fd080bf9a46bdcc274bcbacccedd66d84e203966b197ac25a96932183","73327e6ae34e3f6591877fb75b451cf620cbbd76ee2b678213a9f793633cd0d3","3f1ba2f69944fa346789db7f60d53c9bec00032de0d797967978dea42e77b941","3f5df31539fee4816b97d4e45b4344fbdaf3ca59f6df941f8d780ee441e92cc1","50aaf44eb4d0e086af13729b3471a0a7dce95ea35ebd21c762ba26e203134b2e","3857c1773b8503c3ca45b7bc09ac89c3930c85ce93021054503f73d5d9101b5c","72702bd07fd6fb3ef64aadbcb909103aadfe71ee76e9fdeb11e0c92693cff6cb","f0dd6f7c9783637655478db7d7caf6becd41a79d54482aa59578ce88ab38e9bf",{"version":"cd756ccdabf433dd02b84d755383e489f14b3c1aede0477783aa04830fd5d695","affectsGlobalScope":true},"a4c88dbecdf8ee0c79f5b7c2bf31cd77e593f5d78384e2b674f67d754a549a9e","9cbdff04326da794ba008c0fc977ab062d1fe3fa2e9759654c72ffbe54b64a7c","aa60f8d20d36116fe05edaab24adee3c275209f71b65e272692cf99daf9489e1","150855f967a6490161d5aeed4cc4adf31fcb8f5dbe54b75799c12b8687fc9cc2","cf08b7139adc21b94204e3d4b3daf9946e3462a9e3fdc3e94c87e767e7936e20","47ddb601df40bfa01cebdd06ee8b87d0b72aa1259a4ceba3ad3b5cf68130112a","6b6392704ddb3f50e647dbbb716782bdd0cf8ea9cc134aae256a26223e632b47","afc3ad2a50f7f4de908e26fcf467e09ab8528c0e90f91e602b4865d953839228","df90b0c6b1d81851364c4d97fa23b91a993482bcf4a7bed7c7a24aa41632d494","03c0bc80f67c6f75b02341fbeb9f6ee92c66b90597729377f478885e6ad15a88","11ee9ab699b4619d217c640d917ca198f58066a86bd58c2917197d62aa6601e0","cf9d589d9e73bf32c8e7a6cae6b4a1cf9bef39e5594072533fdce985581a6ddc","959544feb1ca2df29eec6c500f27ea10f4885df245ebd8418fb4b87914614383","6548ab4b57eb9d092471a04513091673345f2fd95d5b876f600402ea8d603ee0","2793e8c6a023d26f78d6777a6d7f20fae3a9a8169863d46d8d54c73071851232","1bf86149ef215f258d479695aa35ac89a3d34a6356a6df04e1b5db869289e563","58f4da9e99a4bdbd2f54eeb9303d5b5634b25423d729d44abb3fc55c925495b3",{"version":"2f700dfc0b29df3605475fcd717c0fc759c95e42067c389cbb503ba3bde9b155","signature":"00abf32ca3af92f8be9ecbc9b63090b4909a756317d791927a83cffd24e9c8ac"},"d0f11e830aa1350a31d9c00a0197243e9711e4882947aef53a96c629f405cb10","6610b9f45f1f71d2b1fb67df49cbcabe3f9e668a1ccb7d8328a51407b259ffb3","abbcc437e0792ab2fe08797ceca1ec85a95ec413c51612313b18ab8e75f690f6","27e882f5d19aee4c49dbdebedbfa79c3233b874adcdcac46295232c4c1bcd13b","1ce746559c2b493ba53418bb35dcfb13b8581bed88c0ac484d92b004077c4b4e",{"version":"27d30b08ab92c978b5f2bbda4a242ea927f908287edce0c2ed11ddcf52c80e01","signature":"900daf04dc607dc3858c0f976d6f9e17b829a07de58d62dc6f730eaf06986075"},{"version":"26351dd9044d932d46fc6472737c5335df5b4a9ad5f1ee1c157d328beb6744f4","signature":"8b2100d3ba68063b7baf5038f26eefe46543dcebf1e7dbaf46277f24307cefcb"},{"version":"5a55c1d9a73f1a1867915a6f043c5d05a439291aec5482b918012ab2d939f809","signature":"aa4d6dc9282133162a76109d99c5795583276c4fd27284f128d484acf12b0841"},"131b7f32092aa78e12fcb2a6db7c71e17f85e076c0635ad8d991b80d10130c19",{"version":"be3a09b63c0d3639c5fd497ed6d3f00fa61ba633e74b841108844ee3b3ff3f47","signature":"d1c84af1e6d5fa4a5f4badd45b03b67c9255a675df235a3ec25307a0f5524278"},{"version":"22f6df7b5f345f4934e261e6b3923d5d28ebf3049349ac8f2921311527217f55","signature":"cd28efe88fac7a92f3f5cfc7dd3c764f0b31bdaaa061ff044de1639810d6a7da"},{"version":"2341c1f3e039d9c25368a901d6c7e64d3743cc2d6b6c4a15fb8f1d194d3c8149","signature":"3355c4c572f076ad963d95f0e28075b8558e2ab492c84eb94f9e2c48f1c2368b"},"cd60a513d4653eb2e9c95b3351cbad232238f140c3eb4f3d48e93ceff7dd7bf7","f3787e74811e0328d91ebf9c1662a50501f457e2df45f53d85b3846c09d015ea","fc670c1c1c1b74b85d4305ea97d18292184b434c7168d40ed60658e187d0e40d",{"version":"e3fc829c75c12182fdad28349413c986d3de96abfd44612d9f4c7668e0f0564f","signature":"5638cfd48b0c56bc9ed0c779d53a40b92c9cd9c9d6312e3a21c52542d38094f3"},"827eb54656695635a6e25543f711f0fe86d1083e5e1c0e84f394ffc122bd3ad7","2309cee540edc190aa607149b673b437cb8807f4e8d921bf7f5a50e6aa8d609c","908a84aef7827422ff7c8623c661bcf2bcb0cb7a30aea39e82a79bbc09042ef6",{"version":"02e8e7131fc1abd33966d638fe9d7aacd18cd63b4310c8cc94d90e8bf9156557","signature":"703509e96cc30dce834ef8188c958c69306473b8a7e5cb3a6f324cee05a1f7bb"},{"version":"0f2be331f7b616109c9bde1fffb31ba7b34efccefe33d4f049735124a273ab4b","signature":"08e0ac95e650bd4c87145b6ab2257b70c06254bf76a0b9f8a7d60c51fb8ed6b8"},"c7d095626fe7d891fdd339ff01cc1d11eae282ca968059f8f3b39a697d8d452b",{"version":"a17d45077b1f4365945d9a515c9f46d3d19bba48b95e34e328c8bba6b5185181","signature":"4b57ec505a035491c692b89af2c6902c312ec22f8fa9b6dae3e93686659fb7e0"},{"version":"d7b7b7bcac03a91ce4f8c1eabe83c37036114662eadab96fbabae768e1572dc9","signature":"7d796672940d3b2d37f2edea4d7bcf4c7993966286006228cbc8fa35ac92871d"},{"version":"cc1d59cb69be74559bf501288731dfdd6b26290c683b20d0f4a0b97f1155d35a","signature":"132fd53917ed7f55275faa52c35e4d4d41e9576fea231d12740b723df2bade93"},{"version":"46dc802039939c036e50a52614744faffaf27060c6bb3a29220311368f7148c7","signature":"de2ecf9b1d6f60338f7b59b6f593ef77af9abd0e70ba8f2942953d0c6e1850af"},{"version":"602d0bbd01b7a0eb6492595cf73d2166d7b8e00fbfb7b0eb82b14e785836513c","signature":"6e503f5e906174df62cf3c7612497591a1dbb63110cdc524f0735a2016a6ad2e"},{"version":"eb9bf627ec34fa295918db1bda351063cad08bb68757a97f50e073c7c2c94da4","signature":"a3b13d166f97ae5900ad6a5b66ecdbb209378d434eca8ea6fc4d6e272b4c2472"},{"version":"c8ce89733658f16c006cf1a0e8f7afd9eaefd35833e46c59af91ee95346be98c","signature":"178e2de7a8702742957ad24deaeddec84a48cd913b5d932b16afd2a707b3e416"},{"version":"7425a64e36c402c1816a0b6aeddbc5d7c0e61b44374c81d949fc9c496ef88975","signature":"6eef4d0ee338cea465480c9cbd575df6f78d47fe0c2df1cd09fadcb7849e10cb"},"95d83d3380f931b477b8001183e8f3166db7b1d49df14466bf90693e223b82b8",{"version":"8162d174e958039d00a43ae124b4e92420f605bbbb409e4da90ebde9970c04ea","signature":"e53d21a2061c7b91944dfebec59bed2ce24ab165f984e3bae0f3a7a9f6c0458e"},{"version":"8a4ebbbdce06d6785bcfbf5cfcba1b3d05379598b9cb4770b04946dbfd30aef0","signature":"6829629d578b001051fb6dc2fb4976fbce015c04666b5a73d97335e003a75f7e"},{"version":"97ccba1e29159b5da70c069808b7d3121abe83f84cbe74d094fc1e5a37b800ac","signature":"53968130af2a091c147ddbdd9c8cfa19e083dd154584d5bef39ad25535650c35"},{"version":"58286a01aa6026d6f7c2bd248cf9af42fb1a0d7ed352becbf7a0de2f8250bb26","signature":"2b1c59d30d4fc731698e792c36c4ed4785966cc00f878c30294aa9b1b042b891"},{"version":"cd8a558b5ce73c6580fc947734e0dc4de24c551ba24a5c4b70eb90524b377378","signature":"27ca878cf70b3030e8403f51ce65949d364fa776d6dae3527f91635a40836672"},{"version":"462a03a5c9312455ef9c84127eb4fd79ba9736bbbbda4bd9f4b76e462d15c94b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"b3de90af7d32d321bba3a0769175f1d2669f13b9e6761a1258ab3a5c0840071d","signature":"d5bbd453310990e851908183fbbef9e6e2db8e0c86d97b42b723fd5238f71c81"},"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2",{"version":"172ab91e087451998f5ecf6f0f533ea89e337d24b6163defe5194899272e3df7","signature":"639f9321a98b734242a3573764d7f1de5369b0b0b10c768ae37639e8bda5dd03"},{"version":"5ba73b9bf3ca8f8c04f970c6618d5d54c3533c84f71ffb8541ded9a13b872a93","signature":"9c79ace686f720f4dd833740f7190e12cdce363362c982c164745527a412ef40"},{"version":"35c5398ee20fc33eaeed9ddc5086bfe780c41852c6ae0fd937069b991cded7d2","signature":"95e76bed30f6e993e1fcc1b90a4675682e4800ae43403547a775d6e3c7ab2b0f"},"75b22c74010ba649de1a1676a4c4b8b5bb4294fecd05089e2094429b16d7840c","4df0891b133884cd9ed752d31c7d0ec0a09234e9ed5394abffd3c660761598db","b603b62d3dcd31ef757dc7339b4fa8acdbca318b0fb9ac485f9a1351955615f9","e642bd47b75ad6b53cbf0dfd7ddfa0f120bd10193f0c58ec37d87b59bf604aca","be90b24d2ee6f875ce3aaa482e7c41a54278856b03d04212681c4032df62baf9","78f5ff400b3cb37e7b90eef1ff311253ed31c8cb66505e9828fad099bffde021","372c47090e1131305d163469a895ff2938f33fa73aad988df31cd31743f9efb6","71c67dc6987bdbd5599353f90009ff825dd7db0450ef9a0aee5bb0c574d18512","6f12403b5eca6ae7ca8e3efe3eeb9c683b06ce3e3844ccfd04098d83cd7e4957","282c535df88175d64d9df4550d2fd1176fd940c1c6822f1e7584003237f179d3","c3a4752cf103e4c6034d5bd449c8f9d5e7b352d22a5f8f9a41a8efb11646f9c2","11a9e38611ac3c77c74240c58b6bd64a0032128b29354e999650f1de1e034b1c","4ed103ca6fff9cb244f7c4b86d1eb28ce8069c32db720784329946731badb5bb","d738f282842970e058672663311c6875482ee36607c88b98ffb6604fba99cb2a","ec859cd8226aa623e41bbb47c249a55ee16dc1b8647359585244d57d3a5ed0c7","8891c6e959d253a66434ff5dc9ae46058fb3493e84b4ca39f710ef2d350656b1","c4463cf02535444dcbc3e67ecd29f1972490f74e49957d6fd4282a1013796ba6","0cb0a957ff02de0b25fd0f3f37130ca7f22d1e0dea256569c714c1f73c6791f8","2f5075dc512d51786b1ba3b1696565641dfaae3ac854f5f13d61fa12ef81a47e","ca3353cc82b1981f0d25d71d7432d583a6ef882ccdea82d65fbe49af37be51cb","50679a8e27aacf72f8c40bcab15d7ef5e83494089b4726b83eec4554344d5cdc","45351e0d51780b6f4088277a4457b9879506ee2720a887de232df0f1efcb33d8","5d697a4b315cc5bb3042ae869abffd10c3b0d7b182cda0e4c45d8819937e5796","563fa27fdaec8f195b84f71a7af0ef48d30d5cc830575db86da86a63a470c8e6","6ee58aa536dabb19b09bc036f1abe83feb51e13d63b23d30b2d0631a2de99b8f","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","299567f84bfedd1468dca2755a829cb19e607a6811673788807dc8921e211bc9","795d9fb85aad92221504db74dd179b506bd189bba0c104426f7e7bb8a66ffee5","1311bc194e0a69fe61031e852c1c0b439e2a2a3d1d5e2d8ff795499b9f283459","4b7ce19369d7e7fae76720c2c6c7f671bf3fa0f7093edb864f1ac358ca7c456c","c972ef44deca1fa8fab465915ffa00f82e126aacf3dfc8979c03b1b066ce5bb6","30285a1011c6d6b52f3ba3abb0a984be8148c05cdefb8eb6eb562335a3991f35","29c188a2c660f99f1b4835022e011c4268d7af989d4b7dda33c0a69ca1a777f8","1ed0bf138e87912d741e28333b58cbf814ae863783b3b404d2454cbabb9c5fc0","3452ee7d8ef0b1bbd47b2a56924a1dc3c79dc84a19d212e9dc496f92e4943aa0","22a21e410a4bf4817ac3b09ab90c51ec5f031edbf2e92a19b6c4832068e1f4c7","612d8ed678ed9c884c875823a72786d4820f84daff536b9ec1e4d9c829a6c66a","62c5c0c428ebac0044c4ae96900ef3da283abcdc76659ce337c720e5e92eb2f4","9bdc5cea7e3bfb096ad8ff730bfb737d922c2a83aeb5253cc1c5bd50115b0fee","55e7b39026dd9cd7b6c68be0a105b5e14063a9bdb8621d385bfb7c468ccebbbe","6963765b0ee8f9ccbcf3e6c85c0e1edc1307d9960b107368e6dff19e9170b444","b599eb810af9ddaba3d57749757c76be8f1095d3d7804984bfe879d25dc85368","e21a6a522121e5dd6c6cdf2a0d8980cd11e2ff1191c2ef05819c300fdd3b25a3","fc68efc28f7783d4756b053f6811fd63d6c4ab4717fd102c638c6471f969093e","2518ed2149cfdb36f7e9bc29561a0d1813d491e2ae78baa7cba49c578b354a27","2d2f0202995cb6116376960f788a6a0df5fe2a38b766de86632295f86d29a058","d160fe745f9c3b72d7b9036fdb2b6b500a520d43e36bb842c927b6fe59ea2c23",{"version":"5a438d8dd13b7ce91cd68cedab414e84604e0bf7c76d2cc2ad7a3207e9dda440","signature":"a17e6861b709149f29a2bd896cee94526df2f06b24a2b60614b56649b5e9aabe"},"97040b190f0daa10cf9a15e51a2fac66b26ddefd7b65998bd6027d1dd67647b7","877c25dfae100e555014e45d1d80364496a0c876201e5dea91a0fd0a6a4ff765","6c360ff81ea615810619342d67cea417bb971ada8961ac1aa86c23aff366c58f","3bae0eca953639d7c2e03211cdf1ad452cf50d48e9779b1ecb56542ad3254a24",{"version":"2217890e61f53e5ac918472ee67f09d3e18b6c83986cd44c31fad5ee810ab997","signature":"23d98226adf3be74e1f0470f85e7fd154cd7aa979d60b43190a7437f0d0426eb"},{"version":"b3fb2293c781a3a174159c616d93adb55f46c915441405e8ab1ec4562fe33414","signature":"439850ca5075c6db55487b2c7fb27a6051fecbf180eee0809b67bb2783a89813"},"75d48857bc4216880443a24d985071262bb8b89a9952c77fd430cb0caa21f9bf",{"version":"3fb089f76b256567da25cced75215c7cdb7c213400848740428ce749607db7d2","signature":"33e40cf77499b3d9712db82e15683373925e85817dbe82a24ee0ee6e44bffb70"},{"version":"a910cbedfe51553a96820818e2c48f1aaa3610b5ecd65990b88c81fb46cc5be4","signature":"d53f9f96afd41359edeb2d5ad98559f3bfad261391d5aef95320fefb0c6a8742"},{"version":"c5a40716a6e879171815bebc71f2dd3bca58c790c7b20a6b8b9733b2ed58319c","signature":"16ac17bcf66fdebd02020be1b452396716134d7a281511bec775f9bec7e04200"},{"version":"7d67bee4b7f9b3390bf729b78390f5b6f8f9ce38753d8180bcfbe92845b8399d","signature":"8b206b995edc6dd849b85c1c56531b9780e3ba75302fd02a2d173f008028707e"},"e5fd6e6b32089a499bafbc66ddae09d7c3c8d7e9c4148d2fd0528ed1fe0c622a",{"version":"825778d44a20eb3346d3e818a560a58cd336505e7c22b020fae2e4c9f75f3ab8","signature":"a42c39d8b7d1b1eccb69c7919ea60dcc2670ea672a0af90b70a730974ec0e9fb"},{"version":"2728e8b5d218e1a32e0ef8f5462ecfb30861c1b3566acfffbbed2917a7ea1d98","signature":"dc5fe5f6b39c3fdfaeba333bcd5f0cc98bb3068797a4d7010f585366f549ddf7"},"2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","b9f96255e1048ed2ea33ec553122716f0e57fc1c3ad778e9aa15f5b46547bd23","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","a1a261624efb3a00ff346b13580f70f3463b8cdcc58b60f5793ff11785d52cab",{"version":"fe21efb975396ae12c2d5c30a5655e1a526718be9db1b92f3d0d5be69b2733a4","signature":"4a3ab8cb278bfd1f18f24cc45a02188b63afa6aef50035df6d79c4638f24059a"},"e724c9ce92f2a8a31ed260764c5455852a13d292e2a31d26acc6840ec0e83208","37ffe3c12813b6a6d512f7c27b71f3388d03dafa10555ad5094cea393ed3d1f6",{"version":"f2b5bdb6a68f7639e080ddfca8902b4c3cb9a73e2130494a245b151f491040a8","signature":"ed2b7ce9544f75d9aece6f8ed250b7c7048c3067de906c2c9f2e68d632b8fdcc"},{"version":"93fdd3d31ad2e6dd70a2389be7890cd88d9610e5ad782ec4bb4a9d6b6a0a9dc3","signature":"78889389420cbcbbe4146345a54cc896a88aa27fbaf759dc9235f1bc66c01a19"},"62af44d31faa5b32c9b29579330556a5340cecbd9d6326d236ed94c3d1667c2c","ddb0b9fcd2670bce028e60ca5768719c5d21508b00dc83acf6af25cbe1fcc5ec","b25c5f2970d06c729f464c0aeaa64b1a5b5f1355aa93554bb5f9c199b8624b1e","8041cfce439ff29d339742389de04c136e3029d6b1817f07b2d7fcbfb7534990","3051751533eee92572241b3cef28333212401408c4e7aa21718714b793c0f4ed","9d38964b57191567a14b396422c87488cecd48f405c642daa734159875ee81d9","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3",{"version":"beb6b19b51d467d5e4f59b7c695f8f82c2e936c25680fc8e160c6feeb335e51c","signature":"c6daa2b36f9950e2ff6bb0138fc2f63a9dfd6e36c1aec88c47e7d06d6ead2d99"},{"version":"568173dcc3cf1a6238056cf96d84e1a31ea310a2a36ceb119e38cf52fb29afa2","signature":"49e2beeee0d4fe340562124e5e9a39d2afacaf567a78d08aad7226457a1aa9ae"},"21522c0f405e58c8dd89cd97eb3d1aa9865ba017fde102d01f86ab50b44e5610","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","d78e5898c8de5e0f934eee83f680262de005caa268d137101b833fd932f95e07","6b25a715df346d7356999c26939b5ea4412f67865f06c55a59dd643817d77a56","1461d03b5381ca3164aed35de1d8565b419e0d7a978ead6b495e3925f1f3f263","edaff827b058523df8cfb6d7812a5084afa6648d4ff5fb01351da8eafe2f0232",{"version":"be7abf1df570aea13a80f9e26c48e4ec51ee5b5c807326fc730eadba8a118905","affectsGlobalScope":true},{"version":"f375b4a3555152aba61fd2d765bb8b618aef03031d271083d614e4b6f3089b6c","affectsGlobalScope":true},{"version":"b63a86ef33f79196f0af1ddfbefbf2ec6860daa4bd34bb8f6cdf0adc69c2fb1c","affectsGlobalScope":true},{"version":"b61b844b8d784ccf5131fe9780ce8ada9a5ae2f89919e4ac241dbca817dfd980","affectsGlobalScope":true},{"version":"379889dd93efc659283b3b88d8c0fd0738e557d8bdf5c9fbf10cee6da71aa9cb","affectsGlobalScope":true},"0bcda522a4bb74c79e11a2c932db88eaca087a6fb11eb3fda4aaa4d655b1783e","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"9c230a07d657b3c65ad79e819b0c362a8ebcc0730f9a3d552a26ea632e2bfd53","c1ea344dc311b2c539ed1e3b4e17e9f4853dc7f348366b51f1d8a09a40fb223f","9990f9e566bc3c2c6e38df81294fb756e7f5b7b0e5bb17ab75384e190548b4b6",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","8566fa84085caa46340393b1704ecd368491918fb45bd688d6e89736aec73a2f","dc33ce27fbeaf0ea3da556c80a6cc8af9d13eb443088c8f25cdc39fca8e756f6","5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","b589d625dde2d63aafbe88143e5fbd7b98dd6aca9782747eafb6e88a3f43f8bc","3f9cc1bdf9e8700facd05b9828032cc01dbc3e500fda6afb2d92509b8442ab2c","13d03ed8573272bf7ff7c574db49f49451bdc84c05cd777d059ae3d36f3a9bce","9aacb691f7080baee1dacad69f91cde282375649e96d8020425cb37d3344b39e","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","31128279dfc964ec361141757bd7872bce19adc3625102f7a1b36ea9dea5a7bc","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","3d2cd8f3047fff04a71e7037a6a4cb9f4accb28dbd8c0d83164d414811025af0",{"version":"549df62b64a71004aee17685b445a8289013daf96246ce4d9b087d13d7a27a61","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"300c86d156193bfa3d2d42e730d166e56f9312f4ae4318230ff0f378728349fb","affectsGlobalScope":true},"bfe1b52cf71aea9bf8815810cc5d9490fa9617313e3d3c2ee3809a28b80d0bb4","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","1d96568a72657f762763c920d3804868db48d638abd87ddcd82bcb200ef9625c","de18acda71730bac52f4b256ce7511bb56cc21f6f114c59c46782eff2f632857","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","2887592574fcdfd087647c539dcb0fbe5af2521270dad4a37f9d17c16190d579","42e8e804d18c78b8fba17c6926b584ec600709c7b4c2f689d45914b15c414b74","905c3e8f7ddaa6c391b60c05b2f4c3931d7127ad717a080359db3df510b7bdab","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"4564f780fd20582c57ae218a4cd017717181ab0e228639d905ef054288655b5e","affectsGlobalScope":true},"ba600bf38b5c1a5dffa1b99dd7a783549082bbba3b4fe9497eaaf5e4c1764b20","ae8cd6af37275eac75f5369cdb5f01063bcf1f48d74cb434303ee50ec446acfe","2518830a2fda9c272ba48798d0e7b857037443b06594db8e42c87e86944ee9e4","95c1cf650d16b197525b5bfdf8dd7abba0a49d99ddb12a4ba66466a8a6903e49","1fe0aabe758d56ad72495d6e6c7b6ae75619faaeaaf03f0ddf1948eea4cfac84","bbc57966c8c48ee78fd58aadb893784025be056ae538ae22d1e83c502a987e68","5e5d6f6697e378b0660b567866bf67d099d0ea754f8810c0dabe737805f5cf03","99ab49d4732fdc98cf5c495925e65e796544cb4086fe42afc235dfc02bcf2351","af8339d509c40da075088e544c28ed37b519876e5c4d36a48644ebfb3c6ae6c8","d393adc32e520d4274bb4c3dfdcdb342b806a230b66ef0f82b35bffbc4aa2590","c26af7eaedb4f710984634e419ab15e54e5bb99a0b3cae71188c2fff572276de","38b58ef018d0aeee42ef74c42978bb5805503233fdeeb82cd2aed2199fb0d013","3b6040253231d44e6778eb6861cc86c1758562e77783d21b7ecbc73322ded539","cc256fd958b33576ed32c7338c64adb0d08fc0c2c6525010202fab83f32745da","fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175",{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"9beb1014927166017e49ed264a564350d28e8bc48b84044efc763b7e213709cb","5774751340e987a6a9e4a5dcc03ff68a6515adc2b91423e1af2f660fc8f30e81","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",{"version":"d27f28f8a18ec93bda158dfd6e8e632a5976c37b2cc9e2fe948f648b3575e870","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","65455ea1b00bae7bd26d3c8c2401eb3d10401c09c55192d6f3b8b2275eda20c2","2494cf4a1e8a989c83f9a9dbb9cd3658d4d496bedd381be5787dec0e2802c800","a95b76aef31395752eb5cb7b386be2e287fdc32dfdf7bdbbb666e333133b1ef7","332c7ccf95426d3156ebedb7295979ef2435bd1c1a940024a4d068da3418718f","e03334588c63840b7054accd0b90f29c5890db6a6555ac0869a78a23297f1396","c3052485f32a96bfde75a2976c1238995522584ba464f04ff16a8a40af5e50d1","c220410b8e956fa157ce4e5e6ac871f0f433aa120c334d906ff1f5e2c7369e95","960a68ced7820108787135bdae5265d2cc4b511b7dcfd5b8f213432a8483daf1","5e8db4872785292074b394d821ae2fc10e4f8edc597776368aebbe8aefb24422","8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","f4cf5f0ad1cfb0ceebbe4fbe8aaf0aa728e899c99cc36ec6c0c4b8f6e8a84c83","7ccce4adb23a87a044c257685613126b47160f6975b224cea5f6af36c7f37514","d51a4e4450ee23d941db79652c660ca2612691dba235fd5d14d4b2a622c72312","acebfe99678cf7cddcddc3435222cf132052b1226e902daac9fbb495c321a9b5","82b1f9a6eefef7386aebe22ac49f23b806421e82dbf35c6e5b7132d79e4165da","67fc055eb86a0632e2e072838f889ffe1754083cb13c8c80a06a7d895d877aae","c6c4fea9acc55d5e38ff2b70d57ab0b5cdbd08f8bc5d7a226e322cea128c5b57","7e77ad30462ed3caffe335308e44a778fe9ad8d590d914d2260e5d456abd1462","61f41da9aaa809e5142b1d849d4e70f3e09913a5cb32c629bf6e61ef27967ff7","abd79d61be476addd783d0e0bace2e3c02bb3e38ec23bdfd236adc421b038939",{"version":"43050667654463f27c2290b98bcd6c01ac33849b0f032c0a66a203b0642c9de4","affectsGlobalScope":true},"b90c59ac4682368a01c83881b814738eb151de8a58f52eb7edadea2bcffb11b9","8560a87b2e9f8e2c3808c8f6172c9b7eb6c9b08cb9f937db71c285ecf292c81d","ffe3931ff864f28d80ae2f33bd11123ad3d7bad9896b910a1e61504cc093e1f5","083c1bd82f8dc3a1ed6fc9e8eaddf141f7c05df418eca386598821e045253af9","274ebe605bd7f71ce161f9f5328febc7d547a2929f803f04b44ec4a7d8729517","6ca0207e70d985a24396583f55836b10dc181063ab6069733561bfde404d1bad","5908142efeaab38ffdf43927ee0af681ae77e0d7672b956dfb8b6c705dbfe106","f772b188b943549b5c5eb803133314b8aa7689eced80eed0b70e2f30ca07ab9c","0026b816ef05cfbf290e8585820eef0f13250438669107dfc44482bac007b14f","05d64cc1118031b29786632a9a0f6d7cf1dcacb303f27023a466cf3cdc860538","e0fff9119e1a5d2fdd46345734126cd6cb99c2d98a9debf0257047fe3937cc3f","d84398556ba4595ee6be554671da142cfe964cbdebb2f0c517a10f76f2b016c0","e275297155ec3251200abbb334c7f5641fecc68b2a9573e40eed50dff7584762","9cbfee0d2998dc92715f33d94e0cf9650b5e07f74cb40331dcccbbeaf4f36872","2dd1d4cea14cead7a7fc9eec8f40593089dff0de8c0199458446143c9b8c4ea9","3bdd93ec24853e61bfa4c63ebaa425ff3e474156e87a47d90122e1d8cc717c1f","e9eb1b173aa166892f3eddab182e49cfe59aa2e14d33aedb6b49d175ed6a3750","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"composite":true,"declaration":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":true,"jsx":4,"jsxImportSource":"@metamask/snaps-sdk","module":6,"outDir":"./types","rootDir":"../src","sourceMap":true,"strict":true,"target":7,"useUnknownInCatchVariables":false},"fileIdsList":[[108,436],[108],[78,108,115,116,117,132],[108,116,117,133,134],[108,115,116],[108,115,132,135,138],[108,115,135,138,139],[108,136,137,138,140,141],[108,115,138],[108,115,132,135,136,137,140],[108,115,123],[108,115],[78,108,115],[66,108,115],[108,119,120,121,122,123,124,125,126,127,128,129,130,131],[108,115,121,122],[108,115,121,123],[108,154,181,349],[108,360,361],[108,154,345,346,347],[108,346],[108,347],[108,328,346,347,348],[108,350],[108,350,351,354,358],[108,357],[108,154,352,353],[108,154,187],[108,154,188],[108,188,189,190,191,192,193],[108,208,217,218,221],[108,208,217,220],[108,208,217,219,221],[108,209,212,213,215],[108,209,210,211],[108,212,213,215,216],[108,209,210,214],[108,220,226],[108,208,217,220,226],[108,217,220,226],[108,217,220,222,223,224,225],[108,208,217,218,219,220,221,226],[108,208,217],[108,154,366],[108,154,349,359,364,365,367],[108,154,349,359,362,363,364,366,367],[108,154,349,365],[108,154,181,366],[108,364,365,366,367,368,369,373],[108,154,194,374],[108,365,366,369],[108,154,370,371,372,374],[108,366,369],[108,154,366,369],[108,154,194,366,367],[108,154,187,194,195],[108,196],[108,115,154,196,199,200],[108,115,154,187,194,196,199],[108,200],[108,195,196,197,200,201,202,203,204],[108,115,197,199,202],[108,195,202],[108,154,194],[108,154,177],[108,177,178],[108,177,178,179,180],[108,154],[50,108,154,376],[50,108,154],[50,108],[53,108],[50,53,108],[51,52,53,54,55,56,57,58,59,60,61,108,143,146,147,148,149,150,151,152,153],[44,50,51,108],[53,59,61,108,142],[108,145],[53,54,108],[50,108,149],[108,209],[108,298],[108,298,299],[108,355,356],[108,436,437,438,439,440],[108,436,438],[81,108,115,445],[72,108,115],[108,115,448],[108,450],[108,451,452,454],[96,108,115],[107,108,115,461],[81,108,115],[108,144],[108,467,468],[108,465,466,467],[78,81,108,115,458,459,460],[108,446,460,461,472],[108,453],[78,108,115,476],[79,108,115],[108,480],[108,486],[78,81,83,86,96,107,108,115],[108,491],[108,491,493],[108,492],[108,498,503],[108,496,499],[108,496,499,500,501],[108,498],[108,324,502],[108,497],[78,108,110,115,517,518,520],[108,519],[108,534],[108,522,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,525,526,527,528,529,530,531,532,533,534],[108,523,524,525,526,527,528,529,530,531,532,533,534],[108,522,523,524,526,527,528,529,530,531,532,533,534],[108,522,523,524,525,527,528,529,530,531,532,533,534],[108,522,523,524,525,526,528,529,530,531,532,533,534],[108,522,523,524,525,526,527,529,530,531,532,533,534],[108,522,523,524,525,526,527,528,530,531,532,533,534],[108,522,523,524,525,526,527,528,529,531,532,533,534],[108,522,523,524,525,526,527,528,529,530,532,533,534],[108,522,523,524,525,526,527,528,529,530,531,533,534],[108,522,523,524,525,526,527,528,529,530,531,532,534],[108,522,523,524,525,526,527,528,529,530,531,532,533],[62,108],[65,108],[66,71,99,108],[67,78,79,86,96,107,108],[67,68,78,86,108],[69,108],[70,71,79,87,108],[71,96,104,108],[72,74,78,86,108],[73,108],[74,75,108],[78,108],[76,78,108],[78,79,80,96,107,108],[78,79,80,93,96,99,108],[108,112],[74,81,86,96,107,108],[78,79,81,82,86,96,104,107,108],[81,83,96,104,107,108],[62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],[78,84,108],[85,107,108],[74,78,86,96,108],[87,108],[88,108],[65,89,108],[90,106,108,112],[91,108],[92,108],[78,93,94,108],[93,95,108,110],[66,78,96,97,98,99,108],[66,96,98,108],[96,97,108],[99,108],[100,108],[78,102,103,108],[102,103,108],[71,86,96,104,108],[105,108],[86,106,108],[66,81,92,107,108],[71,108],[96,108,109],[108,110],[108,111],[66,71,78,80,89,96,107,108,110,112],[96,108,113],[108,486,544],[108,544,545,546,547,548],[108,482,483,484,485],[108,115,198],[79,108,115,477],[108,390,429],[108,390,414,429],[108,429],[108,390],[108,390,415,429],[108,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428],[108,415,429],[79,96,108,115,457],[79,81,108,115],[79,108,473],[81,108,115,471],[108,471],[108,470],[108,115,564,565,566,567,568,569,570,571,572,573,574],[108,563,564,573],[108,564,573],[108,557,563,564,573],[108,564],[71,108,563,573],[108,563,564,565,566,567,568,569,570,571,572,574],[78,81,83,96,104,107,108,113,115],[108,578],[78,96,108,115],[108,303],[108,302],[108,340],[108,340,341,342,343,344],[108,329,330,331,332,333,334,335,336,337,338,339],[108,476],[108,474,475],[108,506],[108,505,506],[108,505],[108,505,506,507,509,510,513,514,515,516],[108,506,510],[108,505,506,507,509,510,511,512],[108,505,510],[108,510,514],[108,506,507,508],[108,507],[108,505,506,510],[43,45,46,47,48,49,108],[43,44,108],[45,108],[44,45,108],[43,45,108],[108,115,154,182],[108,154,282],[108,251],[108,154,182,251,279,282,286,287],[108,115,154,181,182],[108,183,184,185,186,280,281],[44,50,108,279],[44,50,108,185],[108,155],[108,155,167],[108,155,156,169,171],[108,155,167,170],[108,155,161],[108,155,160,162],[108,160,161,162,163],[108,165,166],[108,156,157,158,159,164,167,168,169,170,171,172,173],[108,155,174,175,176,283],[108,155,174,282],[108,266],[108,279],[108,269,270,271,272,273,274,275,276,277],[108,154,228],[108,251,275,282],[108,228,279,282],[108,228,229,252,255,265,266,267,278],[50,108,251,284],[108,279,282],[108,227,229],[108,229],[108,282],[108,252],[108,154,255],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,264],[108,154,257],[108,206,207,230,231,232,233,234,235,253,254,256,257,258,259,260,261,262,263,282],[108,154,227,228],[108,205,265],[108,154,229],[108,249],[50,108,236],[108,237,238,239,240,241,242,243,244,245,246,247,248],[108,236,249,250],[108,284],[108,154,284,288,295],[108,154,284,293,294],[108,154,284,292],[108,154,284,293,294,300],[50,108,154,284,304],[108,284,290],[108,227,284,285,307],[108,154,181,284,288],[79,108,284,311,312],[67,88,108,154,284,317],[79,87,88,108,154,284,294,314,316],[50,108,284,288,311],[108,154,284,288,294],[108,284,321],[108,284,310,311,319,321,323,327,384],[108,284,285,291,293,294,295,296,297,301,305,306,308,309,310,311,314,319,321,323,325,326,327,375,380,382,383,384,386,388,389,430],[50,108,154,284,374],[108,154,284],[50,108,284,288,294,314,382],[108,284,381],[79,88,108,154,284,288,291,316,317,320,380,381,384,432,433],[108,284,382,434],[50,108,154,227,284,285,288,305,309,326,327,375,380,384],[71,78,108,284,306],[50,108,284,288,326],[108,284,312,316,317,318,431,433,435,442],[108,284,320,381,383,384,434],[108,284,436,441],[50,108,154,284,288,289,294,297,301,374,377,378,379,381,383,384],[44,50,108,154,284,288,324,325],[50,108,154,284,294,297,319,382,383],[108,154,284,288,387],[108,284,320,380,381,383,384],[50,108,154,284,429],[108,154,284,289,291],[108,284,292],[108,284,294,315],[79,108,284,292],[288],[294],[292],[50,154,304],[227],[154,181,288],[154,294],[50,284,288,311],[310,311,319,321,323,327,384],[50,154,374],[154],[50,154,288,294,382],[145],[154,316,380,381,384],[50,154,227,288,326],[50,288,326],[312,316,317,318,431,433,435,442],[384],[50,288,374,377,381,383,384],[44,50],[50,154,294,297,319,382,383],[284,288],[79,292]],"referencedMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[285,272],[296,273],[295,274],[293,275],[297,272],[301,276],[305,277],[291,278],[306,272],[308,279],[309,272],[310,280],[313,281],[318,282],[317,283],[311,272],[319,284],[320,285],[322,286],[321,272],[385,287],[431,288],[375,289],[314,290],[383,291],[323,290],[382,292],[434,293],[435,294],[381,295],[312,296],[327,297],[443,298],[433,299],[386,290],[442,300],[380,301],[325,272],[326,302],[384,303],[388,304],[389,305],[430,306],[292,307],[294,308],[316,309],[315,310]],"exportedModulesMap":[[438,1],[436,2],[133,3],[116,2],[135,4],[117,5],[134,2],[139,6],[140,7],[136,7],[142,8],[137,7],[141,9],[138,10],[124,11],[121,12],[128,13],[122,11],[119,14],[127,2],[132,15],[129,2],[130,2],[131,2],[126,12],[123,16],[120,2],[125,17],[360,18],[361,2],[362,19],[328,2],[348,20],[347,21],[346,22],[349,23],[351,24],[359,25],[358,26],[350,2],[354,27],[352,2],[188,28],[189,29],[190,29],[191,2],[192,29],[194,30],[193,29],[219,31],[221,32],[220,33],[208,2],[216,34],[212,35],[213,35],[217,36],[215,37],[222,38],[223,39],[224,40],[226,41],[225,38],[227,42],[218,43],[367,44],[366,45],[365,46],[364,47],[368,48],[374,49],[363,50],[370,51],[373,52],[371,53],[372,54],[369,55],[196,56],[197,57],[202,58],[200,59],[201,60],[205,61],[203,62],[204,63],[195,64],[178,65],[180,2],[179,66],[181,67],[177,68],[187,13],[307,2],[377,69],[376,70],[51,71],[52,71],[54,72],[55,71],[56,71],[57,73],[58,2],[59,2],[60,2],[53,71],[154,74],[61,75],[143,76],[146,77],[147,2],[148,2],[149,2],[150,2],[151,2],[152,78],[153,79],[211,80],[209,2],[210,2],[214,35],[299,81],[300,82],[298,2],[289,2],[355,2],[357,83],[356,2],[444,2],[441,84],[437,1],[439,85],[440,1],[353,12],[446,86],[447,87],[449,88],[452,2],[451,89],[455,90],[456,91],[462,92],[445,93],[463,2],[145,94],[464,2],[469,95],[465,2],[468,96],[467,2],[461,97],[473,98],[454,99],[453,2],[477,100],[478,101],[479,91],[450,2],[481,102],[487,103],[488,2],[489,2],[490,104],[448,91],[491,2],[492,105],[494,106],[495,107],[504,108],[496,2],[500,109],[502,110],[501,109],[499,111],[503,112],[498,113],[497,2],[519,114],[520,115],[466,2],[521,2],[535,116],[523,117],[524,118],[522,119],[525,120],[526,121],[527,122],[528,123],[529,124],[530,125],[531,126],[532,127],[533,128],[534,129],[536,102],[457,2],[537,2],[538,2],[144,2],[62,130],[63,130],[65,131],[66,132],[67,133],[68,134],[69,135],[70,136],[71,137],[72,138],[73,139],[74,140],[75,140],[77,141],[76,142],[78,141],[79,143],[80,144],[64,145],[114,2],[81,146],[82,147],[83,148],[115,149],[84,150],[85,151],[86,152],[87,153],[88,154],[89,155],[90,156],[91,157],[92,158],[93,159],[94,159],[95,160],[96,161],[98,162],[97,163],[99,164],[100,165],[101,2],[102,166],[103,167],[104,168],[105,169],[106,170],[107,171],[108,172],[109,173],[110,174],[111,175],[112,176],[113,177],[539,2],[540,2],[541,2],[484,2],[542,2],[460,2],[459,2],[543,103],[545,178],[547,103],[544,103],[546,178],[548,2],[549,179],[482,2],[486,180],[199,181],[198,2],[550,2],[551,2],[552,182],[553,2],[485,2],[414,183],[415,184],[390,185],[393,185],[412,183],[413,183],[403,183],[402,186],[400,183],[395,183],[408,183],[406,183],[410,183],[394,183],[407,183],[411,183],[396,183],[397,183],[409,183],[391,183],[398,183],[399,183],[401,183],[405,183],[416,187],[404,183],[392,183],[429,188],[428,2],[423,187],[425,189],[424,187],[417,187],[418,187],[420,187],[422,187],[426,189],[427,189],[419,189],[421,189],[458,190],[554,191],[555,192],[472,193],[470,194],[471,195],[556,93],[557,2],[558,2],[559,91],[518,2],[480,2],[560,2],[379,2],[561,2],[562,2],[575,196],[574,197],[565,198],[566,199],[567,199],[568,198],[569,198],[570,198],[571,200],[564,201],[572,197],[573,202],[563,2],[576,2],[577,203],[578,2],[579,204],[580,205],[118,2],[324,2],[304,206],[302,2],[303,207],[483,2],[432,2],[378,2],[339,2],[336,208],[338,208],[337,208],[335,208],[345,209],[340,210],[344,2],[341,2],[343,2],[342,2],[331,208],[332,208],[333,208],[329,2],[330,2],[334,208],[387,2],[474,211],[476,212],[475,211],[507,213],[516,214],[505,2],[506,215],[517,216],[512,217],[513,218],[511,219],[515,220],[509,221],[508,222],[514,223],[510,214],[290,2],[493,2],[43,2],[50,224],[45,225],[46,226],[47,226],[48,227],[49,227],[44,228],[8,2],[9,2],[11,2],[10,2],[2,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[3,2],[4,2],[23,2],[20,2],[21,2],[22,2],[24,2],[25,2],[26,2],[5,2],[27,2],[28,2],[29,2],[30,2],[6,2],[31,2],[32,2],[33,2],[34,2],[7,2],[35,2],[40,2],[41,2],[36,2],[37,2],[38,2],[39,2],[1,2],[42,2],[286,229],[182,230],[287,231],[288,232],[183,233],[184,68],[185,68],[282,234],[280,235],[186,236],[281,2],[155,68],[156,237],[157,237],[158,237],[159,237],[168,237],[169,237],[170,238],[172,239],[173,237],[171,240],[160,237],[162,241],[163,242],[161,237],[164,243],[165,237],[166,237],[167,244],[174,245],[284,246],[176,237],[175,237],[283,247],[228,2],[267,248],[269,68],[270,249],[278,250],[271,68],[272,68],[273,251],[274,68],[276,252],[275,253],[277,71],[268,2],[279,254],[252,255],[206,249],[207,256],[230,257],[231,258],[232,257],[233,2],[234,68],[235,259],[253,260],[254,2],[256,261],[265,262],[258,263],[257,68],[259,68],[260,230],[264,264],[261,259],[262,261],[263,249],[229,265],[266,266],[255,267],[250,268],[237,269],[246,269],[238,269],[239,269],[248,269],[240,269],[241,269],[249,270],[247,269],[242,269],[245,269],[243,269],[244,269],[251,271],[236,71],[296,311],[295,312],[293,313],[301,312],[305,314],[308,315],[310,316],[317,317],[319,318],[320,312],[385,319],[431,288],[375,320],[314,321],[383,322],[323,323],[382,292],[434,324],[435,294],[381,325],[327,326],[443,327],[433,328],[380,329],[326,330],[384,331],[388,332],[389,328],[430,321],[294,308],[316,309],[315,333]],"semanticDiagnosticsPerFile":[438,436,133,116,135,117,134,139,140,136,142,137,141,138,124,121,128,122,119,127,132,129,130,131,126,123,120,125,360,361,362,328,348,347,346,349,351,359,358,350,354,352,188,189,190,191,192,194,193,219,221,220,208,216,212,213,217,215,222,223,224,226,225,227,218,367,366,365,364,368,374,363,370,373,371,372,369,196,197,202,200,201,205,203,204,195,178,180,179,181,177,187,307,377,376,51,52,54,55,56,57,58,59,60,53,154,61,143,146,147,148,149,150,151,152,153,211,209,210,214,299,300,298,289,355,357,356,444,441,437,439,440,353,446,447,449,452,451,455,456,462,445,463,145,464,469,465,468,467,461,473,454,453,477,478,479,450,481,487,488,489,490,448,491,492,494,495,504,496,500,502,501,499,503,498,497,519,520,466,521,535,523,524,522,525,526,527,528,529,530,531,532,533,534,536,457,537,538,144,62,63,65,66,67,68,69,70,71,72,73,74,75,77,76,78,79,80,64,114,81,82,83,115,84,85,86,87,88,89,90,91,92,93,94,95,96,98,97,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,539,540,541,484,542,460,459,543,545,547,544,546,548,549,482,486,199,198,550,551,552,553,485,414,415,390,393,412,413,403,402,400,395,408,406,410,394,407,411,396,397,409,391,398,399,401,405,416,404,392,429,428,423,425,424,417,418,420,422,426,427,419,421,458,554,555,472,470,471,556,557,558,559,518,480,560,379,561,562,575,574,565,566,567,568,569,570,571,564,572,573,563,576,577,578,579,580,118,324,304,302,303,483,432,378,339,336,338,337,335,345,340,344,341,343,342,331,332,333,329,330,334,387,474,476,475,507,516,505,506,517,512,513,511,515,509,508,514,510,290,493,43,50,45,46,47,48,49,44,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,23,20,21,22,24,25,26,5,27,28,29,30,6,31,32,33,34,7,35,40,41,36,37,38,39,1,42,286,182,287,288,183,184,185,282,280,186,281,155,156,157,158,159,168,169,170,172,173,171,160,162,163,161,164,165,166,167,174,284,176,175,283,228,267,269,270,278,271,272,273,274,276,275,277,268,279,252,206,207,230,231,232,233,234,235,253,254,256,265,258,257,259,260,264,261,262,263,229,266,255,250,237,246,238,239,248,240,241,249,247,242,245,243,244,251,236,285,296,295,293,297,301,305,291,306,308,309,310,313,318,317,311,319,320,322,321,385,431,375,314,383,323,382,434,435,381,312,327,443,433,386,442,380,325,326,384,388,389,430,292,294,316,315],"latestChangedDtsFile":"./types/node.d.ts"},"version":"4.8.4"} -\ No newline at end of file -diff --git a/dist/types/structs.d.ts b/dist/types/structs.d.ts -index 48ebab12dbfe4f157a857f7628a876eeace8024b..32dbbfe6b09aa1ed4a6920c8d5696b25423ca736 100644 ---- a/dist/types/structs.d.ts -+++ b/dist/types/structs.d.ts -@@ -1,6 +1,6 @@ - import type { Failure } from 'superstruct'; - import { Struct, StructError } from 'superstruct'; --import type { AnyStruct } from 'superstruct/dist/utils'; -+import type { AnyStruct } from 'superstruct'; - /** - * Infer a struct type, only if it matches the specified type. This is useful - * for defining types and structs that are related to each other in separate diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch deleted file mode 100644 index 2cacf4b6d3..0000000000 --- a/.yarn/patches/@metamask-snaps-utils-npm-7.4.1-b6d8d8bf0a.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/dist/chunk-A6E325SZ.js.map b/dist/chunk-A6E325SZ.js.map -index 9395ea8f11127b1883cf0b26f7049254cb1bf6ac..2bab6aca282a11ec815b3a02863423af8260fb85 100644 ---- a/dist/chunk-A6E325SZ.js.map -+++ b/dist/chunk-A6E325SZ.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAAK,UAAU,GAAG,MAAM;AAAA;AAAA,EAAQ;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ACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAAK,UAAU,GAAG,MAAM;AAAA;AAAA,EAAQ;AAAA,MAC9B;AAAA,MACA,CAAC,GAAG,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,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-GTAYOKI4.mjs.map b/dist/chunk-GTAYOKI4.mjs.map -index 87b357f90e691edb205eba4b1d5991f705dc61fb..15cec06a31a88f47929cc8a9b7cecaef5daa8372 100644 ---- a/dist/chunk-GTAYOKI4.mjs.map -+++ b/dist/chunk-GTAYOKI4.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AA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CAAuC;AAIxE,QAAM,oBAAoB,cAAc;AAAA,IAAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n} from 'superstruct';\nimport type { AnyStruct } from 'superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2CP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR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AAI,CAAC,iBAC3C,SAAS,aAAa,cAAc,EAAE,OAAO,CAAC;AAAA,EAChD;AAEA,QAAM,iBAAiB,kBAAkB,KAAK,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;","names":[]} -\ No newline at end of file -diff --git a/dist/types/structs.d.ts b/dist/types/structs.d.ts -index 48ebab12dbfe4f157a857f7628a876eeace8024b..23aba5966fd09e89eca5e93375e82621cca76f48 100644 ---- a/dist/types/structs.d.ts -+++ b/dist/types/structs.d.ts -@@ -1,6 +1,5 @@ --import type { Failure } from 'superstruct'; -+import type { AnyStruct, Failure } from 'superstruct'; - import { Struct, StructError } from 'superstruct'; --import type { AnyStruct } from 'superstruct/dist/utils'; - /** - * Infer a struct type, only if it matches the specified type. This is useful - * for defining types and structs that are related to each other in separate diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch deleted file mode 100644 index 43df93b32a..0000000000 --- a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch +++ /dev/null @@ -1,702 +0,0 @@ -diff --git a/dist/chunk-2LBN5T56.js.map b/dist/chunk-2LBN5T56.js.map -index 99c2b450d36f7c800c2ed82784b30384e0ace616..efcb2d6787d9547511f94717b32f467a28413d70 100644 ---- a/dist/chunk-2LBN5T56.js.map -+++ b/dist/chunk-2LBN5T56.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/cronjob.ts"],"names":[],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF","sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from 'superstruct';\nimport { array, create, object, optional, refine, string } from 'superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/cronjob.ts"],"names":[],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF","sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, create, object, optional, refine, string } from '@metamask/superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-37VHIRUJ.js.map b/dist/chunk-37VHIRUJ.js.map -index 0307f6d55851cc9ba627142bfc2548e4b416a719..cc92acbd998d37f18246969d0d55557ff5765862 100644 ---- a/dist/chunk-37VHIRUJ.js.map -+++ b/dist/chunk-37VHIRUJ.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/json-rpc.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAuB;AAAA,EAC3B,OAAO,OAAO,GAAG,kBAAkB,CAAC,UAAU;AAC5C,UAAM,YAAY,MAAM,MAAM,GAAG,EAAE,SAAS;AAC5C,QAAI,YAAY,GAAG;AACjB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,mBAAmB;AAAA,EAC9B,OA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AQ,QAAQ,KAAK;AAClE;AAUO,SAAS,uBACd,OACuC;AACvC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B,MAAM,MAAM,OAAO,EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF","sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { array, boolean, object, optional, refine, string } from 'superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/json-rpc.ts"],"names":[],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAuB;AAAA,EAC3B,OAAO,OAAO,GAAG,kBAAkB,CAAC,UAAU;AAC5C,UAAM,YAAY,MAAM,MAAM,GAAG,EAAE,SAAS;AAC5C,QAAI,YAAY,GAAG;AACjB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,mBAAmB;AAAA,EAC9B,OAAO;AAAA,IACL,OAAO,SAAS,QAAQ,CAAC;AAAA,IACzB,OAAO,SAAS,QAAQ,CAAC;AAAA,IACzB,gBAAgB,SAAS,oBAAoB;AAAA,EAC/C,CAAC;AAAA,EACD;AAAA,EACA,CAAC,UAAU;AACT,UA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EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF","sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, object, optional, refine, string } from '@metamask/superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-6LOYTBS3.js.map b/dist/chunk-6LOYTBS3.js.map -index 1dc000f46ea5a9a9d19a5980c8dd35700eeaabed..affde50fa3963a1c1a2236cc4ddf41a74aed7267 100644 ---- a/dist/chunk-6LOYTBS3.js.map -+++ b/dist/chunk-6LOYTBS3.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/namespace.ts"],"names":[],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,SAAO;AAAA,IACL,WAAW,MAAM,OAAO;AAAA,IACxB,WAAW,MAAM,OAAO;AAAA,EAC1B;AACF;AASO,SAAS,eAAe,WAI7B;AACA,QAAM,QAAQ,iBAAiB,KAAK,SAAS;AAC7C,MAAI,CAAC,OAAO,QAAQ;AAClB,UAA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n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from 'superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/namespace.ts"],"names":[],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,SAAO;AAAA,IACL,WAAW,MAAM,OAAO;AAAA,IACxB,WAAW,MAAM,OAAO;AAAA,EAC1B;AACF;AASO,SAAS,eAAe,WAI7B;AACA,QAAM,QAAQ,iBAAiB,KAAK,SAAS;AAC7C,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,SAAO;AAAA,IACL,SAAS,MAAM,OAAO;AAAA,IACtB,SAAS,MAAM,OAAO;AAAA,IACtB,OAAO;AAAA,MACL,WAAW,MAAM,OAAO;AAAA,MACxB,WAAW,MAAM,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAMO,IAAM,gBAAgB,KAAK,OAAO,GAAG,GAAG,EAAE;AAE1C,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA,OAAO,EAAE;AACX;AAKO,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AACF;AAIO,IAAM,kBAAkB,QAAQ,OAAO,GAAG,gBAAgB;AAE1D,IAAM,uBAAuB,MAAM,eAAe;AAClD,IAAM,uBAAuB,QAAQ,OAAO,GAAG,qBAAqB;AAMpE,IAAM,cAAc,OAAO;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AACR,CAAC;AAGM,IAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA,EAIpC,QAAQ,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA,EAKzB,SAAS,SAAS,MAAM,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA,EAKtC,QAAQ,SAAS,MAAM,aAAa,CAAC;AACvC,CAAC;AAMM,IAAM,oBAAoB,QAAQ,OAAO,GAAG,mBAAmB;AAS/D,SAAS,cAAc,OAAsC;AAClE,SAAO,GAAG,OAAO,iBAAiB;AACpC;AAQO,SAAS,UAAU,OAAkC;AAC1D,SAAO,GAAG,OAAO,aAAa;AAChC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,GAAG,OAAO,oBAAoB;AACvC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC","sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from '@metamask/superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-CMOSYNZR.js.map b/dist/chunk-CMOSYNZR.js.map -index 22b53573f3f36f6188cd83ed9a17139cd433afe6..84c783e8a7d742c9a8225fc33a0201f5a552f115 100644 ---- a/dist/chunk-CMOSYNZR.js.map -+++ b/dist/chunk-CMOSYNZR.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/types.ts"],"names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OACL;AAQA,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,iBAAc;AACd,EAAAA,kBAAA,cAAW;AAFD,SAAAA;AAAA,GA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AM,SAAS,CAAC;AAAA,EAC/C;AACF,CAAC;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from 'superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/types.ts"],"names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OACL;AAQA,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,iBAAc;AACd,EAAAA,kBAAA,cAAW;AAFD,SAAAA;AAAA,GAAA;AAKL,IAAM,aAAa;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP;AAAA,EACF;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,2BAA2B,KAAK;AAAA,EAC3C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM,SAAS,KAAK,OAAO,GAAG,GAAG,QAAQ,CAAC;AAAA,EAC1C,YAAY;AAAA,IACV,OAAO;AAAA,MACL,MAAM,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,MAChC,KAAK,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,IACjC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,qBACd,OAC6B;AAC7B,SAAO,GAAG,OAAO,wBAAwB;AAC3C;AAQO,SAAS,2BACd,OACqC;AACrC;AAAA,IACE;AAAA,IACA;AAAA,IACA,IAAI,gCAA4B;AAAA,EAClC;AACF;AAuCO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;AAUL,IAAK,8BAAL,kBAAKC,iCAAL;AACL,EAAAA,6BAAA,kBAAe;AACf,EAAAA,6BAAA,qBAAkB;AAClB,EAAAA,6BAAA,wBAAqB;AACrB,EAAAA,6BAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAQL,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,cAAW;AACX,EAAAA,mBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;AAwBL,IAAM,MAAM,CAAC,OAAwB,CAAC,MAC3C,OAAO,MAAM,CAAC,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU;AACzD,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,KAAK;AAEzB,UAAM,YAAY,KAAK,IAAI;AAC3B,sBAAkB,KAAK,SAAS;AAChC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,sBAAsB,MAAM,SAAS,CAAC;AAAA,EAC/C;AACF,CAAC;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from '@metamask/superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"]} -\ No newline at end of file -diff --git a/dist/chunk-EA2FOAEG.mjs.map b/dist/chunk-EA2FOAEG.mjs.map -index 3adeaad438828651cc310b1e083d5d2621ba2dd0..1691a2a3457b49ca2b255df881915dbd86e08d84 100644 ---- a/dist/chunk-EA2FOAEG.mjs.map -+++ b/dist/chunk-EA2FOAEG.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/cronjob.ts"],"sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from 'superstruct';\nimport { array, create, object, optional, refine, string } from 'superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/cronjob.ts"],"sourcesContent":["import {\n JsonRpcIdStruct,\n JsonRpcParamsStruct,\n JsonRpcVersionStruct,\n} from '@metamask/utils';\nimport { parseExpression } from 'cron-parser';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, create, object, optional, refine, string } from '@metamask/superstruct';\n\nexport const CronjobRpcRequestStruct = object({\n jsonrpc: optional(JsonRpcVersionStruct),\n id: optional(JsonRpcIdStruct),\n method: string(),\n params: optional(JsonRpcParamsStruct),\n});\n\nexport type CronjobRpcRequest = Infer;\n\nexport const CronExpressionStruct = refine(\n string(),\n 'CronExpression',\n (value) => {\n try {\n parseExpression(value);\n return true;\n } catch {\n return false;\n }\n },\n);\n\nexport type CronExpression = Infer;\n\n/**\n * Parses a cron expression.\n *\n * @param expression - Expression to parse.\n * @returns A CronExpression class instance.\n */\nexport function parseCronExpression(expression: string | object) {\n const ensureStringExpression = create(expression, CronExpressionStruct);\n return parseExpression(ensureStringExpression);\n}\n\nexport const CronjobSpecificationStruct = object({\n expression: CronExpressionStruct,\n request: CronjobRpcRequestStruct,\n});\nexport type CronjobSpecification = Infer;\n\n/**\n * Check if the given value is a {@link CronjobSpecification} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link CronjobSpecification} object.\n */\nexport function isCronjobSpecification(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationStruct);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const CronjobSpecificationArrayStruct = array(\n CronjobSpecificationStruct,\n);\n\n/**\n * Check if the given value is an array of {@link CronjobSpecification} objects.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid array of {@link CronjobSpecification} objects.\n */\nexport function isCronjobSpecificationArray(value: unknown): boolean {\n try {\n create(value, CronjobSpecificationArrayStruct);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAEhC,SAAS,OAAO,QAAQ,QAAQ,UAAU,QAAQ,cAAc;AAEzD,IAAM,0BAA0B,OAAO;AAAA,EAC5C,SAAS,SAAS,oBAAoB;AAAA,EACtC,IAAI,SAAS,eAAe;AAAA,EAC5B,QAAQ,OAAO;AAAA,EACf,QAAQ,SAAS,mBAAmB;AACtC,CAAC;AAIM,IAAM,uBAAuB;AAAA,EAClC,OAAO;AAAA,EACP;AAAA,EACA,CAAC,UAAU;AACT,QAAI;AACF,sBAAgB,KAAK;AACrB,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAUO,SAAS,oBAAoB,YAA6B;AAC/D,QAAM,yBAAyB,OAAO,YAAY,oBAAoB;AACtE,SAAO,gBAAgB,sBAAsB;AAC/C;AAEO,IAAM,6BAA6B,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AASM,SAAS,uBAAuB,OAAyB;AAC9D,MAAI;AACF,WAAO,OAAO,0BAA0B;AACxC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,kCAAkC;AAAA,EAC7C;AACF;AAQO,SAAS,4BAA4B,OAAyB;AACnE,MAAI;AACF,WAAO,OAAO,+BAA+B;AAC7C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-EXEEDJ6N.mjs.map b/dist/chunk-EXEEDJ6N.mjs.map -index b8d03c6d15edaae1badb0358c2b528c4308fc54b..6dc21bd6f368c78e657052012e043221a90602e5 100644 ---- a/dist/chunk-EXEEDJ6N.mjs.map -+++ b/dist/chunk-EXEEDJ6N.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/manifest/validation.ts"],"sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from 'superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from 'superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,IAAM,qBAA+B;AAAA,EACnC;AAAA,EACA;AACF;AAEO,IAAM,uBAAiC,CAAC,EAAE;AACjD,IAAM,kBAA8B,qBAAqB,IAAI,CAAC,aAAa;AAAA,EACzE;AAAA,EACA;AAAA,EACA,GAAG,QAAQ;AACb,CAAC;AAEM,IAAM,kBAAkB;AAAA,EAC7B,MAAM,OAAO,CAAC;AAAA,EACd;AAAA,EACA,CAAC,SAAmB;AAClB,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,CAAC,MAAM,KAAK;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,SAAS,GAAG;AACnB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,wBAAwB,IAAI,CAAC,GAAG;AAChE,aAAO;AAAA,IACT;AAEA,QAAI,mBAAmB,SAAS,KAAK,CAAC,CAAC,GAAG;AACxC,aAAO,gBAAgB,KAAK,CAAC,CAAC;AAAA,IAChC;AAEA,QACE,gBAAgB;AAAA,MAAK,CAAC,kBACpB,QAAQ,KAAK,MAAM,GAAG,cAAc,MAAM,G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A,QAC9C,aAAa;AAAA,QACb,UAAU,MAAM;AAAA,UACd,QAAQ,4BAA4B;AAAA,UACpC,QAAQ,6BAA6B;AAAA,QACvC,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,IACD,OAAO,SAAS,uBAAuB;AAAA,IACvC,SAAS,SAAS,uBAAuB;AAAA,EAC3C,CAAC;AAAA,EACD,oBAAoB,SAAS,wBAAwB;AAAA,EACrD,oBAAoB;AAAA,EACpB,iBAAiB,QAAQ,KAAK;AAAA,EAC9B,SAAS,SAAS,OAAO,CAAC;AAAA;AAC5B,CAAC;AAUM,SAAS,eAAe,OAAuC;AACpE,SAAO,GAAG,OAAO,kBAAkB;AACrC;AAQO,SAAS,qBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/manifest/validation.ts"],"sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from '@metamask/superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,IAAM,qBAA+B;AAAA,EACnC;AAAA,EACA;AACF;AAEO,IAAM,uB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O,OAAO,OAAO,kBAAkB;AACzC;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-EXUEHPZ4.mjs.map b/dist/chunk-EXUEHPZ4.mjs.map -index c5e8ed710eea502b656b5f16aa6033ba3bf36c3b..82a2348db4c0b015ce94fbb14ece4a1baf72797e 100644 ---- a/dist/chunk-EXUEHPZ4.mjs.map -+++ b/dist/chunk-EXUEHPZ4.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/namespace.ts"],"sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from 'superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eAAe,KAAK,OAAO;AACzC,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACrC;AAEA,SAAO;AAAA,IACL,WAAW,MAAM,OAAO;AAAA,IACxB,WAAW,MAAM,OAAO;AAAA,EAC1B;AACF;AASO,SAAS,eAAe,WAI7B;AACA,QAAM,QAAQ,iBAAiB,KAAK,SAAS;AAC7C,MAAI,CAAC,OAAO,QAAQ;AAClB,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,SAAO;AAAA,IACL,SAAS,MAAM,OAAO;AAAA,IACtB,SAAS,MAAM,OAAO;AAAA,IACtB,OAAO;AAAA,MACL,WAAW,MAAM,OAAO;AAAA,MACxB,WAAW,MAAM,OAAO;AAAA,IAC1B;AAAA,EACF;AACF;AAMO,IAAM,gBAAgB,KAAK,OAAO,GAAG,GAAG,EAAE;AAE1C,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA,OAAO,EAAE;AACX;AAKO,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AACF;AAIO,IAAM,kBAAkB,QAAQ,OAAO,GAAG,gBAAgB;AAE1D,IAAM,uBAAuB,MAAM,eAAe;AAClD,IAAM,uBAAuB,QAAQ,OAAO,GAAG,qBAAqB;AAMpE,IAAM,cAAc,OAAO;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AACR,CAAC;AAGM,IAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA,EAIpC,QAAQ,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA,EAKzB,SAAS,SAAS,MAAM,aAAa,CAAC;AAAA;AAAA;AAAA;AAAA,EAKtC,QAAQ,SAAS,MAAM,aAAa,CAAC;AACvC,CAAC;AAMM,IAAM,oBAAoB,QAAQ,OAAO,GAAG,mBAAmB;AAS/D,SAAS,cAAc,OAAsC;AAClE,SAAO,GAAG,OAAO,iBAAiB;AACpC;AAQO,SAAS,UAAU,OAAkC;AAC1D,SAAO,GAAG,OAAO,aAAa;AAChC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,GAAG,OAAO,oBAAoB;AACvC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/namespace.ts"],"sourcesContent":["import type { AccountId, ChainId } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n define,\n is,\n object,\n optional,\n pattern,\n size,\n string,\n} from '@metamask/superstruct';\n\nimport type { InferMatching } from './structs';\n\nexport const CHAIN_ID_REGEX =\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u;\n\nexport const ACCOUNT_ID_REGEX =\n /^(?(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})):(?[a-zA-Z0-9]{1,64})$/u;\n\nexport const ACCOUNT_ADDRESS_REGEX = /^(?[a-zA-Z0-9]{1,64})$/u;\n\n/**\n * Parse a chain ID string to an object containing the namespace and reference.\n * This validates the chain ID before parsing it.\n *\n * @param chainId - The chain ID to validate and parse.\n * @returns The parsed chain ID.\n */\nexport function parseChainId(chainId: ChainId): {\n namespace: NamespaceId;\n reference: string;\n} {\n const match = CHAIN_ID_REGEX.exec(chainId);\n if (!match?.groups) {\n throw new Error('Invalid chain ID.');\n }\n\n return {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n };\n}\n\n/**\n * Parse an account ID to an object containing the chain, chain ID and address.\n * This validates the account ID before parsing it.\n *\n * @param accountId - The account ID to validate and parse.\n * @returns The parsed account ID.\n */\nexport function parseAccountId(accountId: AccountId): {\n chain: { namespace: NamespaceId; reference: string };\n chainId: ChainId;\n address: string;\n} {\n const match = ACCOUNT_ID_REGEX.exec(accountId);\n if (!match?.groups) {\n throw new Error('Invalid account ID.');\n }\n\n return {\n address: match.groups.accountAddress,\n chainId: match.groups.chainId as ChainId,\n chain: {\n namespace: match.groups.namespace,\n reference: match.groups.reference,\n },\n };\n}\n\n/**\n * A helper struct for a string with a minimum length of 1 and a maximum length\n * of 40.\n */\nexport const LimitedString = size(string(), 1, 40);\n\nexport const ChainIdStringStruct = define(\n 'Chain ID',\n string().validator,\n);\n\n/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n */\nexport const ChainIdStruct = pattern(\n ChainIdStringStruct,\n CHAIN_ID_REGEX,\n);\n\nexport type Caip2ChainId = InferMatching;\n\nexport const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);\n\nexport const AccountIdArrayStruct = array(AccountIdStruct);\nexport const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);\nexport type AccountAddress = Infer;\n\n/**\n * A chain descriptor.\n */\nexport const ChainStruct = object({\n id: ChainIdStruct,\n name: LimitedString,\n});\nexport type Chain = Infer;\n\nexport const NamespaceStruct = object({\n /**\n * A list of supported chains in the namespace.\n */\n chains: array(ChainStruct),\n\n /**\n * A list of supported RPC methods on the namespace, that a DApp can call.\n */\n methods: optional(array(LimitedString)),\n\n /**\n * A list of supported RPC events on the namespace, that a DApp can listen to.\n */\n events: optional(array(LimitedString)),\n});\nexport type Namespace = Infer;\n\n/**\n * A CAIP-2 namespace, i.e., the first part of a chain ID.\n */\nexport const NamespaceIdStruct = pattern(string(), /^[-a-z0-9]{3,8}$/u);\nexport type NamespaceId = Infer;\n\n/**\n * Check if the given value is a CAIP-2 namespace ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 namespace ID.\n */\nexport function isNamespaceId(value: unknown): value is NamespaceId {\n return is(value, NamespaceIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-2 chain ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-2 chain ID.\n */\nexport function isChainId(value: unknown): value is ChainId {\n return is(value, ChainIdStruct);\n}\n\n/**\n * Check if the given value is a CAIP-10 account ID.\n *\n * @param value - The value to check.\n * @returns Whether the value is a CAIP-10 account ID.\n */\nexport function isAccountId(value: unknown): value is AccountId {\n return is(value, AccountIdStruct);\n}\n\n/**\n * Check if the given value is an array of CAIP-10 account IDs.\n *\n * @param value - The value to check.\n * @returns Whether the value is an array of CAIP-10 account IDs.\n */\nexport function isAccountIdArray(value: unknown): value is AccountId[] {\n return is(value, AccountIdArrayStruct);\n}\n\n/**\n * Check if a value is a {@link Namespace}.\n *\n * @param value - The value to validate.\n * @returns True if the value is a valid {@link Namespace}.\n */\nexport function isNamespace(value: unknown): value is Namespace {\n return is(value, NamespaceStruct);\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBACX;AAEK,IAAM,mBACX;AAEK,IAAM,wBAAwB;AAS9B,SAAS,aAAa,SAG3B;AACA,QAAM,QAAQ,eA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AAO,aAAa;AAChC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;AAQO,SAAS,iBAAiB,OAAsC;AACrE,SAAO,GAAG,OAAO,oBAAoB;AACvC;AAQO,SAAS,YAAY,OAAoC;AAC9D,SAAO,GAAG,OAAO,eAAe;AAClC;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-HEXZ4DFV.js.map b/dist/chunk-HEXZ4DFV.js.map -index e6afcd73012f02f53fb24de0d5776a240c98e82b..37583b7ac1951b880ac7c349b6dce71162345946 100644 ---- a/dist/chunk-HEXZ4DFV.js.map -+++ b/dist/chunk-HEXZ4DFV.js.map -@@ -1 +1,11 @@ --{"version":3,"sources":["../src/structs.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAAK,UAAU,GAAG,MAAM;AAAA;AAAA,EAAQ;AAAA,MAC9B;AAAA,MACA,CAAC,GAAG,SAAS,CAAC;AAAA,MACd;AAAA,IACF,CAAC,GAAG,SAAS;AAAA;AAAA,EAAO,MAAM,KAAK,EAAE;AAAA,EACnC;AACF;AAkBO,UAAU,iBACf,OACkC;AAClC,aAAW,QAAQ,OAAO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M,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;AA+DO,SAAS,gBAAgB,SAAqC;AACnE,QAAM,eAAgB;AAAA,IACpB,GAAG;AAAA,EACL;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,CAAC,QAAQ,OAAO,KAAK;AACnB,iBAAW,UAAU,SAAS;AAC5B,eAAO,OAAO,QAAQ,OAAO,GAAG;AAAA,MAClC;AAAA,IACF;AAAA,EACF,CAAC;AACH","sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from 'superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n"]} -\ No newline at end of file -+{ -+ "version": 3, -+ "sources": [ -+ "../src/structs.ts" -+ ], -+ "names": [], -+ "mappings": ";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAA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gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;AA+DO,SAAS,gBAAgB,SAAqC;AACnE,QAAM,eAAgB;AAAA,IACpB,GAAG;AAAA,EACL;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,CAAC,QAAQ,OAAO,KAAK;AACnB,iBAAW,UAAU,SAAS;AAC5B,eAAO,OAAO,QAAQ,OAAO,GAAG;AAAA,MAClC;AAAA,IACF;AAAA,EACF,CAAC;AACH", -+ "sourcesContent": [ -+ "import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from '@metamask/superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from '@metamask/superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n" -+ ] -+} -\ No newline at end of file -diff --git a/dist/chunk-I4TRH6VO.mjs.map b/dist/chunk-I4TRH6VO.mjs.map -index 5d7641083396d9fa2a352e4a62afa213975e00a1..64ca8fe5a65a041316a740aba0cc9adbf0db2895 100644 ---- a/dist/chunk-I4TRH6VO.mjs.map -+++ b/dist/chunk-I4TRH6VO.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/handlers.ts"],"sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from 'superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,oCAA0B,GAAG;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA4D;AACtE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,0BAAqB,GAAG;AAAA,IACtB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAuD;AACjE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,0CAA6B,GAAG;AAAA,IAC9B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA+D;AACzE,aAAO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pD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/handlers.ts"],"sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from '@metamask/superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,oCAA0B,GAAG;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA4D;AACtE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO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;AAAA,EACxD,SAAS;AACX,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,IAAI,OAAO;AACb,CAAC;AAEM,IAAM,2BAA2B,MAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,0BAA0B,OAAO;AAAA,EAC5C,UAAU,OAAO;AAAA,EACjB,gBAAgB,OAAO;AACzB,CAAC;AAEM,IAAM,yBAAyB,OAAO;AAAA,EAC3C,UAAU,OAAO;AAAA,EACjB,iBAAiB,OAAO;AAAA,EACxB,YAAY,OAAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-IPOE62V4.js.map b/dist/chunk-IPOE62V4.js.map -index ae0c17642528a2a26f624224291b4ef320640d4b..4453253634d79c30fea46a29340454f16f71c2ee 100644 ---- a/dist/chunk-IPOE62V4.js.map -+++ b/dist/chunk-IPOE62V4.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/versions.ts"],"names":[],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C","sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from 'superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/versions.ts"],"names":[],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C","sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from '@metamask/superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-K2OTEZZZ.mjs.map b/dist/chunk-K2OTEZZZ.mjs.map -index b623c2ab78896142fbff273a9813822161439244..a9fcc0f68061a1d9df5235806eea7b4d0cfdbf50 100644 ---- a/dist/chunk-K2OTEZZZ.mjs.map -+++ b/dist/chunk-K2OTEZZZ.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/json-rpc.ts"],"sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from 'superstruct';\nimport { array, boolean, object, optional, refine, string } from 'superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAuB;AAAA,EAC3B,OAAO,OAAO,GAAG,kBAAkB,CAAC,UAAU;AAC5C,UAAM,YAAY,MAAM,MAAM,GAAG,EAAE,SAAS;AAC5C,QAAI,YAAY,GAAG;AACjB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,mBAAmB;AAAA,EAC9B,OAAO;AAAA,IACL,OAAO,SAAS,QAAQ,CAAC;AAAA,IACzB,OAAO,SAAS,QAAQ,CAAC;AAAA,IACzB,gBAAgB,SAAS,oBAAoB;AAAA,EAC/C,CAAC;AAAA,EACD;AAAA,EACA,CAAC,UAAU;AACT,UAAM,aAAa;AAAA,MACjB,MAAM,UAAU,QACd,MAAM,UAAU,QACf,MAAM,kBAAkB,MAAM,eAAe,SAAS;AAAA,IAC3D;AAEA,Q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-rpc.ts"],"sourcesContent":["import { SubjectType } from '@metamask/permission-controller';\nimport type {\n AssertionErrorConstructor,\n Json,\n JsonRpcSuccess,\n} from '@metamask/utils';\nimport {\n assertStruct,\n isJsonRpcFailure,\n isJsonRpcSuccess,\n} from '@metamask/utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, object, optional, refine, string } from '@metamask/superstruct';\n\nconst AllowedOriginsStruct = array(\n refine(string(), 'Allowed origin', (value) => {\n const wildcards = value.split('*').length - 1;\n if (wildcards > 2) {\n return 'No more than two wildcards (\"*\") are allowed in an origin specifier.';\n }\n\n return true;\n }),\n);\n\nexport const RpcOriginsStruct = refine(\n object({\n dapps: optional(boolean()),\n snaps: optional(boolean()),\n allowedOrigins: optional(AllowedOriginsStruct),\n }),\n 'RPC origins',\n (value) => {\n const hasOrigins = Boolean(\n value.snaps === true ||\n value.dapps === true ||\n (value.allowedOrigins && value.allowedOrigins.length > 0),\n );\n\n if (hasOrigins) {\n return true;\n }\n\n return 'Must specify at least one JSON-RPC origin.';\n },\n);\n\nexport type RpcOrigins = Infer;\n\n/**\n * Asserts that the given value is a valid {@link RpcOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link RpcOrigins} object.\n */\nexport function assertIsRpcOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is RpcOrigins {\n assertStruct(\n value,\n RpcOriginsStruct,\n 'Invalid JSON-RPC origins',\n ErrorWrapper,\n );\n}\n\nexport const KeyringOriginsStruct = object({\n allowedOrigins: optional(AllowedOriginsStruct),\n});\n\nexport type KeyringOrigins = Infer;\n\n/**\n * Assert that the given value is a valid {@link KeyringOrigins} object.\n *\n * @param value - The value to assert.\n * @param ErrorWrapper - An optional error wrapper to use. Defaults to\n * {@link AssertionError}.\n * @throws If the value is not a valid {@link KeyringOrigins} object.\n */\nexport function assertIsKeyringOrigins(\n value: unknown,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ErrorWrapper?: AssertionErrorConstructor,\n): asserts value is KeyringOrigins {\n assertStruct(\n value,\n KeyringOriginsStruct,\n 'Invalid keyring origins',\n ErrorWrapper,\n );\n}\n\n/**\n * Create regular expression for matching against an origin while allowing wildcards.\n *\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n *\n * @param matcher - The string to create the regular expression with.\n * @returns The regular expression.\n */\nfunction createOriginRegExp(matcher: string) {\n // Escape potential Regex characters\n const escaped = matcher.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n // Support wildcards\n const regex = escaped.replace(/\\*/gu, '.*');\n return RegExp(regex, 'u');\n}\n\n/**\n * Check whether an origin is allowed or not using a matcher string.\n *\n * The matcher string may be a specific origin to match or include wildcards.\n * The \"*\" symbol is treated as a wildcard and will match 0 or more characters.\n * Note: this means that https://*metamask.io matches both https://metamask.io\n * and https://snaps.metamask.io.\n *\n * @param matcher - The matcher string.\n * @param origin - The origin.\n * @returns Whether the origin is allowed.\n */\nfunction checkAllowedOrigin(matcher: string, origin: string) {\n // If the matcher is a single wildcard or identical to the origin we can return true immediately.\n if (matcher === '*' || matcher === origin) {\n return true;\n }\n\n const regex = createOriginRegExp(matcher);\n return regex.test(origin);\n}\n\n/**\n * Check if the given origin is allowed by the given JSON-RPC origins object.\n *\n * @param origins - The JSON-RPC origins object.\n * @param subjectType - The type of the origin.\n * @param origin - The origin to check.\n * @returns Whether the origin is allowed.\n */\nexport function isOriginAllowed(\n origins: RpcOrigins,\n subjectType: SubjectType,\n origin: string,\n) {\n // The MetaMask client is always allowed.\n if (origin === 'metamask') {\n return true;\n }\n\n // If the origin is in the `allowedOrigins` list, it is allowed.\n if (\n origins.allowedOrigins?.some((matcher) =>\n checkAllowedOrigin(matcher, origin),\n )\n ) {\n return true;\n }\n\n // If the origin is a website and `dapps` is true, it is allowed.\n if (subjectType === SubjectType.Website && origins.dapps) {\n return true;\n }\n\n // If the origin is a snap and `snaps` is true, it is allowed.\n return Boolean(subjectType === SubjectType.Snap && origins.snaps);\n}\n\n/**\n * Assert that the given value is a successful JSON-RPC response. If the value\n * is not a success response, an error is thrown. If the value is an JSON-RPC\n * error, the error message is included in the thrown error.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSON-RPC success response.\n */\nexport function assertIsJsonRpcSuccess(\n value: unknown,\n): asserts value is JsonRpcSuccess {\n if (!isJsonRpcSuccess(value)) {\n if (isJsonRpcFailure(value)) {\n throw new Error(`JSON-RPC request failed: ${value.error.message}`);\n }\n\n throw new Error('Invalid JSON-RPC response.');\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAM5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,OAAO,SAAS,QAAQ,UAAU,QAAQ,cAAc;AAEjE,IAAM,uBAAuB;AAAA,EAC3B,OAAO,OAAO,GAAG,kBAAkB,CAAC,UAAU;AAC5C,UAAM,YAAY,MAAM,MAAM,GAAG,EAAE,SAAS;AAC5C,QAAI,YAAY,GAAG;AACjB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,mBAAmB;AAAA,EAC9B,OAAO;AAAA,IACL,OAAO,SAAS,QAAQ,CAAC;AAAA,IACzB,OAAO,SAAS,QAAQ,CAAC;AAAA,IACzB,gBAAgB,SAAS,oBAAoB;AAAA,EAC/C,CAAC;AAAA,EACD;AAAA,EACA,CAAC,UAAU;AACT,UAAM,aAAa;AAAA,MACjB,MAAM,UAAU,QACd,MAAM,UAAU,QACf,MAAM,kBAAkB,MAAM,eAAe,SAAS;AAAA,IAC3D;AAEA,QAAI,YAAY;AACd,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AACF;AAYO,SAAS,mBACd,OAEA,cAC6B;AAC7B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,uBAAuB,OAAO;AAAA,EACzC,gBAAgB,SAAS,oBAAoB;AAC/C,CAAC;AAYM,SAAS,uBACd,OAEA,cACiC;AACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAUA,SAAS,mBAAmB,SAAiB;AAE3C,QAAM,UAAU,QAAQ,QAAQ,wBAAwB,MAAM;AAE9D,QAAM,QAAQ,QAAQ,QAAQ,QAAQ,IAAI;AAC1C,SAAO,OAAO,OAAO,GAAG;AAC1B;AAcA,SAAS,mBAAmB,SAAiB,QAAgB;AAE3D,MAAI,YAAY,OAAO,YAAY,QAAQ;AACzC,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,mBAAmB,OAAO;AACxC,SAAO,MAAM,KAAK,MAAM;AAC1B;AAUO,SAAS,gBACd,SACA,aACA,QACA;AAEA,MAAI,WAAW,YAAY;AACzB,WAAO;AAAA,EACT;AAGA,MACE,QAAQ,gBAAgB;AAAA,IAAK,CAAC,YAC5B,mBAAmB,SAAS,MAAM;AAAA,EACpC,GACA;AACA,WAAO;AAAA,EACT;AAGA,MAAI,gBAAgB,YAAY,WAAW,QAAQ,OAAO;AACxD,WAAO;AAAA,EACT;AAGA,SAAO,QAAQ,gBAAgB,YAAY,QAAQ,QAAQ,KAAK;AAClE;AAUO,SAAS,uBACd,OACuC;AACvC,MAAI,CAAC,iBAAiB,KAAK,GAAG;AAC5B,QAAI,iBAAiB,KAAK,GAAG;AAC3B,YAAM,IAAI,MAAM,4BAA4B,MAAM,MAAM,OAAO,EAAE;AAAA,IACnE;AAEA,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAC9C;AACF;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-K4B37F3L.js.map b/dist/chunk-K4B37F3L.js.map -index bb47f82ae64b7c323a9e436e60611a30557544d1..5f353c3538fd5408070be0294c934309621dccdc 100644 ---- a/dist/chunk-K4B37F3L.js.map -+++ b/dist/chunk-K4B37F3L.js.map -@@ -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ACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF","sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from 'superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from 'superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/snaps.ts"],"names":["SnapStatus","SnapStatusEvents"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+GL,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAG1D,YAAY,SAAiB,QAAqC;AAChE,UAAM,OAAO;AACb,SAAK,SAAS;AAAA,EAChB;AACF;AAQA,SAAS,yBACP,UACa;AACb,QAAM,eAAe,SAAS,MAAM;AACpC,SAAO,aAAa,OAAO,OAAO;AAIlC,eAAa,QAAQ,gBAAgB,aAAa,MAAM;AACxD,SAAO;AACT;AAQA,eAAsB,gBACpB,OACiB;AACjB,QAAM,EAAE,UAAU,YAAY,SAAS,gBAAgB,kBAAkB,IACvE;AAEF,QAAM,MAAM;AAAA,IACV,yBAAyB,QAAQ;AAAA,IACjC;AAAA,IACA;AAAA,IACA,GAAG;AAAA,IACH,GAAG;AAAA,EACL,EAAE,OAAO,CAAC,SAAS,SAAS,MAAS;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7C;AAAA,EACF;AAEA,QAAM,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF","sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from '@metamask/superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from '@metamask/superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"]} -\ No newline at end of file -diff --git a/dist/chunk-NHGIT2SZ.mjs.map b/dist/chunk-NHGIT2SZ.mjs.map -index 120c6ed6c981ea15ce54af2ee50e3606a95a7c18..08b57cf5253fe0bb5f9a7153d832ce5e1a3dc030 100644 ---- a/dist/chunk-NHGIT2SZ.mjs.map -+++ b/dist/chunk-NHGIT2SZ.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from 'superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from 'superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from 'superstruct/dist/utils';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;AAEvB,SAAK,OAAO;AACZ,SAAK,UAAU,GAAG,MAAM;AAAA;AAAA,EAAQ;AAAA,MAC9B;AAAA,MACA,CAAC,GAAG,SAAS,CAAC;AAAA,MACd;AAAA,IACF,CAAC,GAAG,SAAS;AAAA;AAAA,EAAO,MAAM,KAAK,EAAE;AAAA,EACnC;AACF;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,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;AA+DO,SAAS,gBAAgB,SAAqC;AACnE,QAAM,eAAgB;AAAA,IACpB,GAAG;AAAA,EACL;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,CAAC,QAAQ,OAAO,KAAK;AACnB,iBAAW,UAAU,SAAS;AAC5B,eAAO,OAAO,QAAQ,OAAO,GAAG;AAAA,MAClC;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/structs.ts"],"sourcesContent":["import { union } from '@metamask/snaps-sdk';\nimport type { NonEmptyArray } from '@metamask/utils';\nimport { assert, isObject } from '@metamask/utils';\nimport { bold, green, red } from 'chalk';\nimport type { Failure } from '@metamask/superstruct';\nimport {\n is,\n validate,\n type as superstructType,\n Struct,\n StructError,\n create,\n assign,\n} from '@metamask/superstruct';\nimport type {\n AnyStruct,\n Assign,\n ObjectSchema,\n ObjectType,\n} from '@metamask/superstruct';\n\nimport { indent } from './strings';\n\n/**\n * Infer a struct type, only if it matches the specified type. This is useful\n * for defining types and structs that are related to each other in separate\n * files.\n *\n * @example\n * ```typescript\n * // In file A\n * export type GetFileArgs = {\n * path: string;\n * encoding?: EnumToUnion;\n * };\n *\n * // In file B\n * export const GetFileArgsStruct = object(...);\n *\n * // If the type and struct are in the same file, this will return the type.\n * // Otherwise, it will return `never`.\n * export type GetFileArgs =\n * InferMatching;\n * ```\n */\nexport type InferMatching<\n StructType extends Struct,\n Type,\n> = StructType['TYPE'] extends Type ? Type : never;\n\n/**\n * Colorize a value with a color function. This is useful for colorizing values\n * in error messages. If colorization is disabled, the original value is\n * returned.\n *\n * @param value - The value to colorize.\n * @param colorFunction - The color function to use.\n * @param enabled - Whether to colorize the value.\n * @returns The colorized value, or the original value if colorization is\n * disabled.\n */\nfunction color(\n value: string,\n colorFunction: (value: string) => string,\n enabled: boolean,\n) {\n if (enabled) {\n return colorFunction(value);\n }\n\n return value;\n}\n\n/**\n * Define a struct, and also define the name of the struct as the given name.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param name - The name of the struct.\n * @param struct - The struct.\n * @returns The struct.\n */\nexport function named(\n name: string,\n struct: Struct,\n) {\n return new Struct({\n ...struct,\n type: name,\n });\n}\n\nexport class SnapsStructError extends StructError {\n constructor(\n struct: Struct,\n prefix: string,\n suffix: string,\n failure: StructError,\n failures: () => Generator,\n colorize = true,\n ) {\n super(failure, failures);\n\n this.name = 'SnapsStructError';\n this.message = `${prefix}.\\n\\n${getStructErrorMessage(\n struct,\n [...failures()],\n colorize,\n )}${suffix ? `\\n\\n${suffix}` : ''}`;\n }\n}\n\ntype GetErrorOptions = {\n struct: Struct;\n prefix: string;\n suffix?: string;\n error: StructError;\n colorize?: boolean;\n};\n\n/**\n * Converts an array to a generator function that yields the items in the\n * array.\n *\n * @param array - The array.\n * @returns A generator function.\n * @yields The items in the array.\n */\nexport function* arrayToGenerator(\n array: Type[],\n): Generator {\n for (const item of array) {\n yield item;\n }\n}\n\n/**\n * Returns a `SnapsStructError` with the given prefix and suffix.\n *\n * @param options - The options.\n * @param options.struct - The struct that caused the error.\n * @param options.prefix - The prefix to add to the error message.\n * @param options.suffix - The suffix to add to the error message. Defaults to\n * an empty string.\n * @param options.error - The `superstruct` error to wrap.\n * @param options.colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The `SnapsStructError`.\n */\nexport function getError({\n struct,\n prefix,\n suffix = '',\n error,\n colorize,\n}: GetErrorOptions) {\n return new SnapsStructError(\n struct,\n prefix,\n suffix,\n error,\n () => arrayToGenerator(error.failures()),\n colorize,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `create` function that throws a\n * `SnapsStructError` instead of a `StructError`. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` struct to validate the value against.\n * @param prefix - The prefix to add to the error message.\n * @param suffix - The suffix to add to the error message. Defaults to an empty\n * string.\n * @returns The validated value.\n */\nexport function createFromStruct(\n value: unknown,\n struct: Struct,\n prefix: string,\n suffix = '',\n) {\n try {\n return create(value, struct);\n } catch (error) {\n if (error instanceof StructError) {\n throw getError({ struct, prefix, suffix, error });\n }\n\n throw error;\n }\n}\n\n/**\n * Get a struct from a failure path.\n *\n * @param struct - The struct.\n * @param path - The failure path.\n * @returns The struct at the failure path.\n */\nexport function getStructFromPath(\n struct: Struct,\n path: string[],\n) {\n return path.reduce((result, key) => {\n if (isObject(struct.schema) && struct.schema[key]) {\n return struct.schema[key] as AnyStruct;\n }\n\n return result;\n }, struct);\n}\n\n/**\n * Get the union struct names from a struct.\n *\n * @param struct - The struct.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The union struct names, or `null` if the struct is not a union\n * struct.\n */\nexport function getUnionStructNames(\n struct: Struct,\n colorize = true,\n) {\n if (Array.isArray(struct.schema)) {\n return struct.schema.map(({ type }) => color(type, green, colorize));\n }\n\n return null;\n}\n\n/**\n * Get an error prefix from a `superstruct` failure. This is useful for\n * formatting the error message returned by `superstruct`.\n *\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns The error prefix.\n */\nexport function getStructErrorPrefix(failure: Failure, colorize = true) {\n if (failure.type === 'never' || failure.path.length === 0) {\n return '';\n }\n\n return `At path: ${color(failure.path.join('.'), bold, colorize)} — `;\n}\n\n/**\n * Get a string describing the failure. This is similar to the `message`\n * property of `superstruct`'s `Failure` type, but formats the value in a more\n * readable way.\n *\n * @param struct - The struct that caused the failure.\n * @param failure - The `superstruct` failure.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the failure.\n */\nexport function getStructFailureMessage(\n struct: Struct,\n failure: Failure,\n colorize = true,\n) {\n const received = color(JSON.stringify(failure.value), red, colorize);\n const prefix = getStructErrorPrefix(failure, colorize);\n\n if (failure.type === 'union') {\n const childStruct = getStructFromPath(struct, failure.path);\n const unionNames = getUnionStructNames(childStruct, colorize);\n\n if (unionNames) {\n return `${prefix}Expected the value to be one of: ${unionNames.join(\n ', ',\n )}, but received: ${received}.`;\n }\n\n return `${prefix}${failure.message}.`;\n }\n\n if (failure.type === 'literal') {\n // Superstruct's failure does not provide information about which literal\n // value was expected, so we need to parse the message to get the literal.\n const message = failure.message\n .replace(\n /the literal `(.+)`,/u,\n `the value to be \\`${color('$1', green, colorize)}\\`,`,\n )\n .replace(\n /, but received: (.+)/u,\n `, but received: ${color('$1', red, colorize)}`,\n );\n\n return `${prefix}${message}.`;\n }\n\n if (failure.type === 'never') {\n return `Unknown key: ${color(\n failure.path.join('.'),\n bold,\n colorize,\n )}, received: ${received}.`;\n }\n\n if (failure.refinement === 'size') {\n const message = failure.message\n .replace(\n /length between `(\\d+)` and `(\\d+)`/u,\n `length between ${color('$1', green, colorize)} and ${color(\n '$2',\n green,\n colorize,\n )},`,\n )\n .replace(/length of `(\\d+)`/u, `length of ${color('$1', red, colorize)}`)\n .replace(/a array/u, 'an array');\n\n return `${prefix}${message}.`;\n }\n\n return `${prefix}Expected a value of type ${color(\n failure.type,\n green,\n colorize,\n )}, but received: ${received}.`;\n}\n\n/**\n * Get a string describing the errors. This formats all the errors in a\n * human-readable way.\n *\n * @param struct - The struct that caused the failures.\n * @param failures - The `superstruct` failures.\n * @param colorize - Whether to colorize the value. Defaults to `true`.\n * @returns A string describing the errors.\n */\nexport function getStructErrorMessage(\n struct: Struct,\n failures: Failure[],\n colorize = true,\n) {\n const formattedFailures = failures.map((failure) =>\n indent(`• ${getStructFailureMessage(struct, failure, colorize)}`),\n );\n\n return formattedFailures.join('\\n');\n}\n\n/**\n * Validate a union struct, and throw readable errors if the value does not\n * satisfy the struct. This is useful for improving the error messages returned\n * by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @param coerce - Whether to coerce the value to satisfy the struct. Defaults\n * to `false`.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @example\n * const struct = union([\n * object({ type: literal('a'), value: string() }),\n * object({ type: literal('b'), value: number() }),\n * object({ type: literal('c'), value: boolean() }),\n * // ...\n * ]);\n *\n * // At path: type — Expected the value to be one of: \"a\", \"b\", \"c\", but received: \"d\".\n * validateUnion({ type: 'd', value: 'foo' }, struct, 'type');\n *\n * // At path: value — Expected a value of type string, but received: 42.\n * validateUnion({ type: 'a', value: 42 }, struct, 'value');\n */\nexport function validateUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n coerce = false,\n) {\n assert(\n struct.schema,\n 'Expected a struct with a schema. Make sure to use `union` from `@metamask/snaps-sdk`.',\n );\n assert(struct.schema.length > 0, 'Expected a non-empty array of structs.');\n\n const keyUnion = struct.schema.map(\n (innerStruct) => innerStruct.schema[structKey],\n // This is guaranteed to be a non-empty array by the assertion above. We\n // need to cast it since `superstruct` requires a non-empty array of structs\n // for the `union` struct.\n ) as NonEmptyArray;\n\n const key = superstructType({\n [structKey]: union(keyUnion),\n });\n\n const [keyError] = validate(value, key, { coerce });\n if (keyError) {\n throw new Error(\n getStructFailureMessage(key, keyError.failures()[0], false),\n );\n }\n\n // At this point it's guaranteed that the value is an object, so we can safely\n // cast it to a Record.\n const objectValue = value as Record;\n const objectStructs = struct.schema.filter((innerStruct) =>\n is(objectValue[structKey], innerStruct.schema[structKey]),\n );\n\n assert(objectStructs.length > 0, 'Expected a struct to match the value.');\n\n // We need to validate the value against all the object structs that match the\n // struct key, and return the first validated value.\n const validationResults = objectStructs.map((objectStruct) =>\n validate(objectValue, objectStruct, { coerce }),\n );\n\n const validatedValue = validationResults.find(([error]) => !error);\n if (validatedValue) {\n return validatedValue[1];\n }\n\n assert(validationResults[0][0], 'Expected at least one error.');\n\n // If there is no validated value, we need to find the error with the least\n // number of failures (with the assumption that it's the most specific error).\n const validationError = validationResults.reduce((error, [innerError]) => {\n assert(innerError, 'Expected an error.');\n if (innerError.failures().length < error.failures().length) {\n return innerError;\n }\n\n return error;\n }, validationResults[0][0]);\n\n throw new Error(\n getStructFailureMessage(struct, validationError.failures()[0], false),\n );\n}\n\n/**\n * Create a value with the coercion logic of a union struct, and throw readable\n * errors if the value does not satisfy the struct. This is useful for improving\n * the error messages returned by `superstruct`.\n *\n * @param value - The value to validate.\n * @param struct - The `superstruct` union struct to validate the value against.\n * This struct must be a union of object structs, and must have at least one\n * shared key to validate against.\n * @param structKey - The key to validate against. This key must be present in\n * all the object structs in the union struct, and is expected to be a literal\n * value.\n * @returns The validated value.\n * @throws If the value does not satisfy the struct.\n * @see validateUnion\n */\nexport function createUnion[]>(\n value: unknown,\n struct: Struct,\n structKey: keyof Type,\n) {\n return validateUnion(value, struct, structKey, true);\n}\n\n// These types are copied from Superstruct, to mirror `assign`.\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n): Struct>, Assign>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n): Struct<\n ObjectType, ObjectC>>,\n Assign, ObjectC>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n): Struct<\n ObjectType, ObjectC>, ObjectD>>,\n Assign, ObjectC>, ObjectD>\n>;\nexport function mergeStructs<\n ObjectA extends ObjectSchema,\n ObjectB extends ObjectSchema,\n ObjectC extends ObjectSchema,\n ObjectD extends ObjectSchema,\n ObjectE extends ObjectSchema,\n>(\n A: Struct, ObjectA>,\n B: Struct, ObjectB>,\n C: Struct, ObjectC>,\n D: Struct, ObjectD>,\n E: Struct, ObjectE>,\n): Struct<\n ObjectType<\n Assign, ObjectC>, ObjectD>, ObjectE>\n >,\n Assign, ObjectC>, ObjectD>, ObjectE>\n>;\n\n/**\n * Merge multiple structs into one, using superstruct `assign`.\n *\n * Differently from plain `assign`, this function also copies over refinements from each struct.\n *\n * @param structs - The `superstruct` structs to merge.\n * @returns The merged struct.\n */\nexport function mergeStructs(...structs: Struct[]): Struct {\n const mergedStruct = (assign as (...structs: Struct[]) => Struct)(\n ...structs,\n );\n return new Struct({\n ...mergedStruct,\n *refiner(value, ctx) {\n for (const struct of structs) {\n yield* struct.refiner(value, ctx);\n }\n },\n });\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa;AAEtB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,MAAM,OAAO,WAAW;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgDP,SAAS,MACP,OACA,eACA,SACA;AACA,MAAI,SAAS;AACX,WAAO,cAAc,KAAK;AAAA,EAC5B;AAEA,SAAO;AACT;AAWO,SAAS,MACd,MACA,QACA;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,MAAM;AAAA,EACR,CAAC;AACH;AAEO,IAAM,mBAAN,cAA6C,YAAY;AAAA,EAC9D,YACE,QACA,QACA,QACA,SACA,UACA,WAAW,MACX;AACA,UAAM,SAAS,QAAQ;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AAM,CAAC,KAAK;AACjE,MAAI,gBAAgB;AAClB,WAAO,eAAe,CAAC;AAAA,EACzB;AAEA,SAAO,kBAAkB,CAAC,EAAE,CAAC,GAAG,8BAA8B;AAI9D,QAAM,kBAAkB,kBAAkB,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;AACxE,WAAO,YAAY,oBAAoB;AACvC,QAAI,WAAW,SAAS,EAAE,SAAS,MAAM,SAAS,EAAE,QAAQ;AAC1D,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;AAE1B,QAAM,IAAI;AAAA,IACR,wBAAwB,QAAQ,gBAAgB,SAAS,EAAE,CAAC,GAAG,KAAK;AAAA,EACtE;AACF;AAkBO,SAAS,YACd,OACA,QACA,WACA;AACA,SAAO,cAAc,OAAO,QAAQ,WAAW,IAAI;AACrD;AA+DO,SAAS,gBAAgB,SAAqC;AACnE,QAAM,eAAgB;AAAA,IACpB,GAAG;AAAA,EACL;AACA,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,CAAC,QAAQ,OAAO,KAAK;AACnB,iBAAW,UAAU,SAAS;AAC5B,eAAO,OAAO,QAAQ,OAAO,GAAG;AAAA,MAClC;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-OJM2SKJZ.js.map b/dist/chunk-OJM2SKJZ.js.map -index a622c3eb7b64f74286be6ef92c07d0d979a06390..19e60107094e01124b389f80675aa40b70e538e8 100644 ---- a/dist/chunk-OJM2SKJZ.js.map -+++ b/dist/chunk-OJM2SKJZ.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/handlers.ts"],"names":[],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe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ACzB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA0D;AACpE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AACF;AAEO,IAAM,sCAAsC,OAAO;AAAA,EACxD,UAAU,SAAS,QAAQ,cAAc,QAAQ,CAAC;AACpD,CAAC;AAEM,IAAM,oCAAoC;AAAA,EAC/C;AAAA,EACA,OAAO;AAAA,IACL,IAAI,OAAO;AAAA,EACb,CAAC;AACH;AAEO,IAAM,yCAAyC;AAAA,EACpD;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,EACX,CAAC;AACH;AAEO,IAAM,8BAA8B;AAAA,EACzC,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEO,IAAM,4BAA4B;AAElC,IAAM,sCAAsC,OAAO;AAAA,EACxD,SAAS;AACX,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,IAAI,OAAO;AACb,CAAC;AAEM,IAAM,2BAA2B,MAAM;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,0BAA0B,OAAO;AAAA,EAC5C,UAAU,OAAO;AAAA,EACjB,gBAAgB,OAAO;AACzB,CAAC;AAEM,IAAM,yBAAyB,OAAO;AAAA,EAC3C,UAAU,OAAO;AAAA,EACjB,iBAAiB,OAAO;AAAA,EACxB,YAAY,OAAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE","sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from 'superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/handlers.ts"],"names":[],"mappings":";AAYA,SAAS,0BAA0B,qBAAqB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,IAAM,eAAe;AAAA,EAC1B,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,oCAA0B,GAAG;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA4D;AACtE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,kCAAyB,GAAG;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAA2D;AACrE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,4BAAsB,GAAG;AAAA,IACvB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAwD;AAClE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,0BAAqB,GAAG;AAAA,IACtB;AAAA,IACA,UAAU;AAAA,IACV,WAAW,CAAC,eAAuD;AACjE,aAAO,OAAO,eAAe;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,0CAA6B,GAAG;AAAA,IAC9B;AAAA,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AAO;AACrB,CAAC;AAEM,IAAM,kCAAkC,OAAO;AAAA,EACpD,iBAAiB,KAAK,MAAM,uBAAuB,GAAG,GAAG,QAAQ;AACnE,CAAC;AAEM,IAAM,iCAAiC,OAAO;AAAA,EACnD,mBAAmB,KAAK,MAAM,sBAAsB,GAAG,GAAG,QAAQ;AACpE,CAAC;AAEM,IAAM,6BAA6B;AAAA,EACxC,MAAM,CAAC,iCAAiC,8BAA8B,CAAC;AACzE","sourcesContent":["import type {\n OnCronjobHandler,\n OnHomePageHandler,\n OnInstallHandler,\n OnKeyringRequestHandler,\n OnNameLookupHandler,\n OnRpcRequestHandler,\n OnSignatureHandler,\n OnTransactionHandler,\n OnUpdateHandler,\n OnUserInputHandler,\n} from '@metamask/snaps-sdk';\nimport { ComponentOrElementStruct, SeverityLevel } from '@metamask/snaps-sdk';\nimport {\n assign,\n literal,\n nullable,\n object,\n optional,\n string,\n array,\n size,\n union,\n} from '@metamask/superstruct';\n\nimport type { SnapHandler } from './handler-types';\nimport { HandlerType } from './handler-types';\n\nexport type SnapRpcHookArgs = {\n origin: string;\n handler: HandlerType;\n request: Record;\n};\n\nexport const SNAP_EXPORTS = {\n [HandlerType.OnRpcRequest]: {\n type: HandlerType.OnRpcRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnRpcRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnTransaction]: {\n type: HandlerType.OnTransaction,\n required: true,\n validator: (snapExport: unknown): snapExport is OnTransactionHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnCronjob]: {\n type: HandlerType.OnCronjob,\n required: true,\n validator: (snapExport: unknown): snapExport is OnCronjobHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnNameLookup]: {\n type: HandlerType.OnNameLookup,\n required: true,\n validator: (snapExport: unknown): snapExport is OnNameLookupHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnInstall]: {\n type: HandlerType.OnInstall,\n required: false,\n validator: (snapExport: unknown): snapExport is OnInstallHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUpdate]: {\n type: HandlerType.OnUpdate,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUpdateHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnKeyringRequest]: {\n type: HandlerType.OnKeyringRequest,\n required: true,\n validator: (snapExport: unknown): snapExport is OnKeyringRequestHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnHomePage]: {\n type: HandlerType.OnHomePage,\n required: true,\n validator: (snapExport: unknown): snapExport is OnHomePageHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnSignature]: {\n type: HandlerType.OnSignature,\n required: true,\n validator: (snapExport: unknown): snapExport is OnSignatureHandler => {\n return typeof snapExport === 'function';\n },\n },\n [HandlerType.OnUserInput]: {\n type: HandlerType.OnUserInput,\n required: false,\n validator: (snapExport: unknown): snapExport is OnUserInputHandler => {\n return typeof snapExport === 'function';\n },\n },\n} as const;\n\nexport const OnTransactionSeverityResponseStruct = object({\n severity: optional(literal(SeverityLevel.Critical)),\n});\n\nexport const OnTransactionResponseWithIdStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n id: string(),\n }),\n);\n\nexport const OnTransactionResponseWithContentStruct = assign(\n OnTransactionSeverityResponseStruct,\n object({\n content: ComponentOrElementStruct,\n }),\n);\n\nexport const OnTransactionResponseStruct = nullable(\n union([\n OnTransactionResponseWithContentStruct,\n OnTransactionResponseWithIdStruct,\n ]),\n);\n\nexport const OnSignatureResponseStruct = OnTransactionResponseStruct;\n\nexport const OnHomePageResponseWithContentStruct = object({\n content: ComponentOrElementStruct,\n});\n\nexport const OnHomePageResponseWithIdStruct = object({\n id: string(),\n});\n\nexport const OnHomePageResponseStruct = union([\n OnHomePageResponseWithContentStruct,\n OnHomePageResponseWithIdStruct,\n]);\n\nexport const AddressResolutionStruct = object({\n protocol: string(),\n resolvedDomain: string(),\n});\n\nexport const DomainResolutionStruct = object({\n protocol: string(),\n resolvedAddress: string(),\n domainName: string(),\n});\n\nexport const AddressResolutionResponseStruct = object({\n resolvedDomains: size(array(AddressResolutionStruct), 1, Infinity),\n});\n\nexport const DomainResolutionResponseStruct = object({\n resolvedAddresses: size(array(DomainResolutionStruct), 1, Infinity),\n});\n\nexport const OnNameLookupResponseStruct = nullable(\n union([AddressResolutionResponseStruct, DomainResolutionResponseStruct]),\n);\n\n/**\n * Utility type for getting the handler function type from a handler type.\n */\nexport type HandlerFunction =\n Type['validator'] extends (snapExport: unknown) => snapExport is infer Handler\n ? Handler\n : never;\n\n/**\n * All the function-based handlers that a snap can implement.\n */\nexport type SnapFunctionExports = {\n [Key in keyof typeof SNAP_EXPORTS]?: HandlerFunction<\n (typeof SNAP_EXPORTS)[Key]\n >;\n};\n\n/**\n * All handlers that a snap can implement.\n */\nexport type SnapExports = SnapFunctionExports;\n"]} -\ No newline at end of file -diff --git a/dist/chunk-R5DO7T2D.js.map b/dist/chunk-R5DO7T2D.js.map -index b390f18cbf1b3e55bd82fc01c337ed068a12973e..48f29fe714b4dd41823c5e16b40bf400ec7d013d 100644 ---- a/dist/chunk-R5DO7T2D.js.map -+++ b/dist/chunk-R5DO7T2D.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/localization.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OAAO,CAAC;AAAA,IAChC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,8BACd,mBACiC;AACjC,aAAW,QAAQ,mBAAmB;AACpC,QAA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AU,UAAU;AACpD,UAAM,cAAc,UAAU,SAAS,KAAK,GAAG,IAAI;AACnD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,KAAK,GAAG;AAAA,IACX;AAAA,EACF,GAAG,YAAY;AACjB;AASO,SAAS,kCACd,cACA,mBACA;AACA,MAAI;AAGF,sBACG,OAAO,CAAC,SAAS,KAAK,WAAW,IAAI,EACrC,QAAQ,CAAC,SAAS;AACjB,+BAAyB,cAAc,KAAK,QAAQ,iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from 'superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/localization.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OAAO,CAAC;AAAA,IAChC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,8BACd,mBACiC;AACjC,aAAW,QAAQ,mBAAmB;AACpC,QAAI;AACF,WAAK,SAAS,OAAO,UAAU,KAAK,SAAS,CAAC,GAAG,sBAAsB;AAAA,IACzE,SAAS,OAAO;AACd,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,yCAAyC,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,QACvE;AAAA,MACF;AAEA,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,sCAAsC,KAAK,IAAI;AAAA,QACjD;AAAA,MACF;AAEA,YAAM;AAAA,IACR;AAAA,EACF;AAEA,SA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Ac,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF","sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from '@metamask/superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"]} -\ No newline at end of file -diff --git a/dist/chunk-T6FWIDA6.mjs.map b/dist/chunk-T6FWIDA6.mjs.map -index be6d80b92f7a57482e3338b4ca61efbe9707ea83..d32530db73b52bece342442d8fe86fe3edb69219 100644 ---- a/dist/chunk-T6FWIDA6.mjs.map -+++ b/dist/chunk-T6FWIDA6.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from 'superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from 'superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OACL;AAQA,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,iBAAc;AACd,EAAAA,kBAAA,cAAW;AAFD,SAAAA;AAAA,GAAA;AAKL,IAAM,aAAa;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP;AAAA,EACF;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,2BAA2B,KAAK;AAAA,EAC3C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM,SAAS,KAAK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ailureReason","SNAP_STREAM_NAMES"]} -\ No newline at end of file -+{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\nimport { assertStruct, VersionStruct } from '@metamask/utils';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n instance,\n is,\n object,\n optional,\n pattern,\n refine,\n size,\n string,\n type,\n union,\n assert as assertSuperstruct,\n} from '@metamask/superstruct';\n\nimport type { SnapCaveatType } from './caveats';\nimport type { SnapFunctionExports, SnapRpcHookArgs } from './handlers';\nimport type { LocalizationFile } from './localization';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport enum NpmSnapFileNames {\n PackageJson = 'package.json',\n Manifest = 'snap.manifest.json',\n}\n\nexport const NameStruct = size(\n pattern(\n string(),\n /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*$/u,\n ),\n 1,\n 214,\n);\n\n// Note we use `type` instead of `object` here, because the latter does not\n// allow unknown keys.\nexport const NpmSnapPackageJsonStruct = type({\n version: VersionStruct,\n name: NameStruct,\n main: optional(size(string(), 1, Infinity)),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n});\n\nexport type NpmSnapPackageJson = Infer &\n Record;\n\n/**\n * Check if the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link NpmSnapPackageJson} object.\n */\nexport function isNpmSnapPackageJson(\n value: unknown,\n): value is NpmSnapPackageJson {\n return is(value, NpmSnapPackageJsonStruct);\n}\n\n/**\n * Asserts that the given value is a valid {@link NpmSnapPackageJson} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link NpmSnapPackageJson} object.\n */\nexport function assertIsNpmSnapPackageJson(\n value: unknown,\n): asserts value is NpmSnapPackageJson {\n assertStruct(\n value,\n NpmSnapPackageJsonStruct,\n `\"${NpmSnapFileNames.PackageJson}\" is invalid`,\n );\n}\n\n/**\n * An object for storing parsed but unvalidated Snap file contents.\n */\nexport type UnvalidatedSnapFiles = {\n manifest?: VirtualFile;\n packageJson?: VirtualFile;\n sourceCode?: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * An object for storing the contents of Snap files that have passed JSON\n * Schema validation, or are non-empty if they are strings.\n */\nexport type SnapFiles = {\n manifest: VirtualFile;\n packageJson: VirtualFile;\n sourceCode: VirtualFile;\n svgIcon?: VirtualFile;\n auxiliaryFiles: VirtualFile[];\n localizationFiles: VirtualFile[];\n};\n\n/**\n * A subset of snap files extracted from a fetched snap.\n */\nexport type FetchedSnapFiles = Pick<\n SnapFiles,\n 'manifest' | 'sourceCode' | 'svgIcon' | 'auxiliaryFiles' | 'localizationFiles'\n>;\n\n/**\n * The possible prefixes for snap ids.\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SnapIdPrefixes {\n npm = 'npm:',\n local = 'local:',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Snap validation failure reason codes that are programmatically fixable\n * if validation occurs during development.\n */\nexport enum SnapValidationFailureReason {\n NameMismatch = '\"name\" field mismatch',\n VersionMismatch = '\"version\" field mismatch',\n RepositoryMismatch = '\"repository\" field mismatch',\n ShasumMismatch = '\"shasum\" field mismatch',\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum SNAP_STREAM_NAMES {\n JSON_RPC = 'jsonRpc',\n COMMAND = 'command',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n// The snap is the callee\nexport type SnapRpcHook = (options: SnapRpcHookArgs) => Promise;\n\ntype ObjectParameters<\n Type extends Record unknown>,\n> = Parameters;\n\nexport type SnapExportsParameters = ObjectParameters;\n\ntype UriOptions = {\n protocol?: Struct;\n hash?: Struct;\n port?: Struct;\n hostname?: Struct;\n pathname?: Struct;\n search?: Struct;\n};\n\nexport const uri = (opts: UriOptions = {}) =>\n refine(union([string(), instance(URL)]), 'uri', (value) => {\n try {\n const url = new URL(value);\n\n const UrlStruct = type(opts);\n assertSuperstruct(url, UrlStruct);\n return true;\n } catch {\n return `Expected URL, got \"${value.toString()}\".`;\n }\n });\n\n/**\n * Returns whether a given value is a valid URL.\n *\n * @param url - The value to check.\n * @param opts - Optional constraints for url checking.\n * @returns Whether `url` is valid URL or not.\n */\nexport function isValidUrl(\n url: unknown,\n opts: UriOptions = {},\n): url is string | URL {\n return is(url, uri(opts));\n}\n\n// redefining here to avoid circular dependency\nexport const WALLET_SNAP_PERMISSION_KEY = 'wallet_snap';\n\nexport type SnapsPermissionRequest = {\n [WALLET_SNAP_PERMISSION_KEY]: {\n caveats: [\n {\n type: SnapCaveatType.SnapIds;\n value: Record;\n },\n ];\n };\n};\n"],"mappings":";AACA,SAAS,cAAc,qBAAqB;AAE5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,OACL;AAQA,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,iBAAc;AACd,EAAAA,kBAAA,cAAW;AAFD,SAAAA;AAAA,GAAA;AAKL,IAAM,aAAa;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP;AAAA,EACF;AAAA,EACA;AAAA,EACA;AACF;AAIO,IAAM,2BAA2B,KAAK;AAAA,EAC3C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM,SAAS,KAAK,OAAO,GAAG,GAAG,QAAQ,CAAC;AAAA,EAC1C,YAAY;AAAA,IACV,OAAO;AAAA,MACL,MAAM,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,MAChC,KAAK,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,IACjC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,qBACd,OAC6B;AAC7B,SAAO,GAAG,OAAO,wBAAwB;AAC3C;AAQO,SAAS,2BACd,OACqC;AACrC;AAAA,IACE;AAAA,IACA;AAAA,IACA,IAAI,gCAA4B;AAAA,EAClC;AACF;AAuCO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,WAAQ;AAFE,SAAAA;AAAA,GAAA;AAUL,IAAK,8BAAL,kBAAKC,iCAAL;AACL,EAAAA,6BAAA,kBAAe;AACf,EAAAA,6BAAA,qBAAkB;AAClB,EAAAA,6BAAA,wBAAqB;AACrB,EAAAA,6BAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAQL,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,cAAW;AACX,EAAAA,mBAAA,aAAU;AAFA,SAAAA;AAAA,GAAA;AAwBL,IAAM,MAAM,CAAC,OAAwB,CAAC,MAC3C,OAAO,MAAM,CAAC,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU;AACzD,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,KAAK;AAEzB,UAAM,YAAY,KAAK,IAAI;AAC3B,sBAAkB,KAAK,SAAS;AAChC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,sBAAsB,MAAM,SAAS,CAAC;AAAA,EAC/C;AACF,CAAC;AASI,SAAS,WACd,KACA,OAAwB,CAAC,GACJ;AACrB,SAAO,GAAG,KAAK,IAAI,IAAI,CAAC;AAC1B;AAGO,IAAM,6BAA6B;","names":["NpmSnapFileNames","SnapIdPrefixes","SnapValidationFailureReason","SNAP_STREAM_NAMES"]} -\ No newline at end of file -diff --git a/dist/chunk-UMZNVWEM.mjs.map b/dist/chunk-UMZNVWEM.mjs.map -index 068c800d29873541cc45a70b944c837e5721e8dc..6acac0bb8bc9dce262d6e17e4057a2b7ba2dad3f 100644 ---- a/dist/chunk-UMZNVWEM.mjs.map -+++ b/dist/chunk-UMZNVWEM.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/versions.ts"],"sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from 'superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/versions.ts"],"sourcesContent":["import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils';\nimport { VersionRangeStruct } from '@metamask/utils';\nimport { maxSatisfying as maxSatisfyingSemver } from 'semver';\nimport { validate } from '@metamask/superstruct';\n\nexport const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange;\n\n/**\n * Return the highest version in the list that satisfies the range, or `null` if\n * none of them do. For the satisfaction check, pre-release versions will only\n * be checked if no satisfactory non-prerelease version is found first.\n *\n * @param versions - The list of version to check.\n * @param versionRange - The SemVer version range to check against.\n * @returns The highest version in the list that satisfies the range,\n * or `null` if none of them do.\n */\nexport function getTargetVersion(\n versions: SemVerVersion[],\n versionRange: SemVerRange,\n): SemVerVersion | null {\n const maxSatisfyingNonPreRelease = maxSatisfyingSemver(\n versions,\n versionRange,\n );\n\n // By default don't use pre-release versions\n if (maxSatisfyingNonPreRelease) {\n return maxSatisfyingNonPreRelease;\n }\n\n // If no satisfying release version is found by default, try pre-release versions\n return maxSatisfyingSemver(versions, versionRange, {\n includePrerelease: true,\n });\n}\n\n/**\n * Parse a version received by some subject attempting to access a snap.\n *\n * @param version - The received version value.\n * @returns `*` if the version is `undefined` or `latest\", otherwise returns\n * the specified version.\n */\nexport function resolveVersionRange(\n version?: Json,\n): [error: undefined, range: SemVerRange] | [error: Error, range: undefined] {\n if (version === undefined || version === 'latest') {\n return [undefined, DEFAULT_REQUESTED_SNAP_VERSION];\n }\n return validate(version, VersionRangeStruct);\n}\n"],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,gBAAgB;AAElB,IAAM,iCAAiC;AAYvC,SAAS,iBACd,UACA,cACsB;AACtB,QAAM,6BAA6B;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAGA,MAAI,4BAA4B;AAC9B,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,UAAU,cAAc;AAAA,IACjD,mBAAmB;AAAA,EACrB,CAAC;AACH;AASO,SAAS,oBACd,SAC2E;AAC3E,MAAI,YAAY,UAAa,YAAY,UAAU;AACjD,WAAO,CAAC,QAAW,8BAA8B;AAAA,EACnD;AACA,SAAO,SAAS,SAAS,kBAAkB;AAC7C;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-WZ457PEQ.mjs.map b/dist/chunk-WZ457PEQ.mjs.map -index 033c5aadae4bede2958eeb2331507609b3650588..b958605e41d54d9979bb8f84fecaedc41c711d95 100644 ---- a/dist/chunk-WZ457PEQ.mjs.map -+++ b/dist/chunk-WZ457PEQ.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/localization.ts"],"sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from 'superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from 'superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OAAO,CAAC;AAAA,IAChC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,8BACd,mBACiC;AACjC,aAAW,QAAQ,mBAAmB;AACpC,QAAI;AACF,WAAK,SAAS,OAAO,UAAU,KAAK,SAAS,CAAC,GAAG,sBAAsB;AAAA,IACzE,SAAS,OAAO;AACd,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,yCAAyC,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,QACvE;AAAA,MACF;AAEA,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,sCAAsC,KAAK,IAAI;AAAA,QACjD;AAAA,MACF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iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;","names":[]} -\ No newline at end of file -+{"version":3,"sources":["../src/localization.ts"],"sourcesContent":["import { getErrorMessage } from '@metamask/snaps-sdk';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n create,\n object,\n optional,\n record,\n string,\n StructError,\n} from '@metamask/superstruct';\n\nimport { parseJson } from './json';\nimport type { SnapManifest } from './manifest';\nimport type { VirtualFile } from './virtual-file';\n\nexport const LOCALIZABLE_FIELDS = ['description', 'proposedName'] as const;\n\nexport const LocalizationFileStruct = object({\n locale: string(),\n messages: record(\n string(),\n object({\n message: string(),\n description: optional(string()),\n }),\n ),\n});\n\nexport type LocalizationFile = Infer;\n\n/**\n * Validate a list of localization files.\n *\n * @param localizationFiles - The localization files to validate.\n * @returns The validated localization files.\n * @throws If any of the files are considered invalid.\n */\nexport function getValidatedLocalizationFiles(\n localizationFiles: VirtualFile[],\n): VirtualFile[] {\n for (const file of localizationFiles) {\n try {\n file.result = create(parseJson(file.toString()), LocalizationFileStruct);\n } catch (error) {\n if (error instanceof StructError) {\n throw new Error(\n `Failed to validate localization file \"${file.path}\": ${error.message}.`,\n );\n }\n\n if (error instanceof SyntaxError) {\n throw new Error(\n `Failed to parse localization file \"${file.path}\" as JSON.`,\n );\n }\n\n throw error;\n }\n }\n\n return localizationFiles as VirtualFile[];\n}\n\n/**\n * Get the localization file for a given locale. If the locale is not found,\n * the English localization file will be returned.\n *\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localization file, or `undefined` if no localization file was\n * found.\n */\nexport function getLocalizationFile(\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = localizationFiles.find(\n (localizationFile) => localizationFile.locale === locale,\n );\n\n if (!file) {\n return localizationFiles.find(\n (localizationFile) => localizationFile.locale === 'en',\n );\n }\n\n return file;\n}\n\nexport const TRANSLATION_REGEX = /\\{\\{\\s?([a-zA-Z0-9-_\\s]+)\\s?\\}\\}/gu;\n\n/**\n * Translate a string using a localization file. This will replace all instances\n * of `{{key}}` with the localized version of `key`.\n *\n * @param value - The string to translate.\n * @param file - The localization file to use, or `undefined` if no localization\n * file was found.\n * @returns The translated string.\n * @throws If the string contains a key that is not present in the localization\n * file, or if no localization file was found.\n */\nexport function translate(value: string, file: LocalizationFile | undefined) {\n const matches = value.matchAll(TRANSLATION_REGEX);\n const array = Array.from(matches);\n\n return array.reduce((result, [match, key]) => {\n if (!file) {\n throw new Error(\n `Failed to translate \"${value}\": No localization file found.`,\n );\n }\n\n const translation = file.messages[key.trim()];\n if (!translation) {\n throw new Error(\n `Failed to translate \"${value}\": No translation found for \"${key.trim()}\" in \"${\n file.locale\n }\" file.`,\n );\n }\n\n return result.replace(match, translation.message);\n }, value);\n}\n\n/**\n * Get the localized Snap manifest for a given locale. This will replace all\n * localized strings in the manifest with the localized version.\n *\n * @param snapManifest - The Snap manifest to localize.\n * @param locale - The locale to use.\n * @param localizationFiles - The localization files to use.\n * @returns The localized Snap manifest.\n */\nexport function getLocalizedSnapManifest(\n snapManifest: SnapManifest,\n locale: string,\n localizationFiles: LocalizationFile[],\n) {\n const file = getLocalizationFile(locale, localizationFiles);\n\n return LOCALIZABLE_FIELDS.reduce((manifest, field) => {\n const translation = translate(manifest[field], file);\n return {\n ...manifest,\n [field]: translation,\n };\n }, snapManifest);\n}\n\n/**\n * Validate the localization files for a Snap manifest.\n *\n * @param snapManifest - The Snap manifest to validate.\n * @param localizationFiles - The localization files to validate.\n * @throws If the manifest cannot be localized.\n */\nexport function validateSnapManifestLocalizations(\n snapManifest: SnapManifest,\n localizationFiles: LocalizationFile[],\n) {\n try {\n // `translate` throws if the manifest cannot be localized, so we just attempt\n // to translate the manifest using all localization files.\n localizationFiles\n .filter((file) => file.locale !== 'en')\n .forEach((file) => {\n getLocalizedSnapManifest(snapManifest, file.locale, localizationFiles);\n });\n\n // The manifest must be localizable in English.\n getLocalizedSnapManifest(snapManifest, 'en', localizationFiles);\n } catch (error) {\n throw new Error(\n `Failed to localize Snap manifest: ${getErrorMessage(error)}`,\n );\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMA,IAAM,qBAAqB,CAAC,eAAe,cAAc;AAEzD,IAAM,yBAAyB,OAAO;AAAA,EAC3C,QAAQ,OAAO;AAAA,EACf,UAAU;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,MACL,SAAS,OAAO;AAAA,MAChB,aAAa,SAAS,OAAO,CAAC;AAAA,IAChC,CAAC;AAAA,EACH;AACF,CAAC;AAWM,SAAS,8BACd,mBACiC;AACjC,aAAW,QAAQ,mBAAmB;AACpC,QAAI;AACF,WAAK,SAAS,OAAO,UAAU,KAAK,SAAS,CAAC,GAAG,sBAAsB;AAAA,IACzE,SAAS,OAAO;AACd,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,yCAAyC,KAAK,IAAI,MAAM,MAAM,OAAO;AAAA,QACvE;AAAA,MACF;AAEA,UAAI,iBAAiB,aAAa;AAChC,cAAM,IAAI;AAAA,UACR,sCAAsC,KAAK,IAAI;AAAA,QACjD;AAAA,MACF;AAEA,YAAM;AAAA,IACR;AAAA,EACF;AAEA,SAAO;AACT;AAWO,SAAS,oBACd,QACA,mBACA;AACA,QAAM,OAAO,kBAAkB;AAAA,IAC7B,CAAC,qBAAqB,iBAAiB,WAAW;AAAA,EACpD;AAEA,MAAI,CAAC,MAAM;AACT,WAAO,kBAAkB;AAAA,MACvB,CAAC,qBAAqB,iBAAiB,WAAW;AAAA,IACpD;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,oBAAoB;AAa1B,SAAS,UAAU,OAAe,MAAoC;AAC3E,QAAM,UAAU,MAAM,SAAS,iBAAiB;AAChD,QAAM,QAAQ,MAAM,KAAK,OAAO;AAEhC,SAAO,MAAM,OAAe,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM;AACpD,QAAI,CAAC,MAAM;AACT,YAAM,IAAI;AAAA,QACR,wBAAwB,KAAK;AAAA,MAC/B;AAAA,IACF;AAEA,UAAM,cAAc,KAAK,SAAS,IAAI,KAAK,CAAC;AAC5C,QAAI,CAAC,aAAa;AAChB,YAAM,IAAI;AAAA,QACR,wBAAwB,KAAK,gCAAgC,IAAI,KAAK,CAAC,SACrE,KAAK,MACP;AAAA,MACF;AAAA,IACF;AAEA,WAAO,OAAO,QAAQ,OAAO,YAAY,OAAO;AAAA,EAClD,GAAG,KAAK;AACV;AAWO,SAAS,yBACd,cACA,QACA,mBACA;AACA,QAAM,OAAO,oBAAoB,QAAQ,iBAAiB;AAE1D,SAAO,mBAAmB,OAAO,CAAC,UAAU,UAAU;AACpD,UAAM,cAAc,UAAU,SAAS,KAAK,GAAG,IAAI;AACnD,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,KAAK,GAAG;AAAA,IACX;AAAA,EACF,GAAG,YAAY;AACjB;AASO,SAAS,kCACd,cACA,mBACA;AACA,MAAI;AAGF,sBACG,OAAO,CAAC,SAAS,KAAK,WAAW,IAAI,EACrC,QAAQ,CAAC,SAAS;AACjB,+BAAyB,cAAc,KAAK,QAAQ,iBAAiB;AAAA,IACvE,CAAC;AAGH,6BAAyB,cAAc,MAAM,iBAAiB;AAAA,EAChE,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,qCAAqC,gBAAgB,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;","names":[]} -\ No newline at end of file -diff --git a/dist/chunk-YCIPY3UP.mjs.map b/dist/chunk-YCIPY3UP.mjs.map -index 5321ffd13eb7a88be2952f1e156cd774d5e9444b..5ba5fe5846aa56f87e227efea27ce2ae9138f0bc 100644 ---- a/dist/chunk-YCIPY3UP.mjs.map -+++ b/dist/chunk-YCIPY3UP.mjs.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/snaps.ts"],"sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from 'superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from 'superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+GL,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAG1D,YAAY,SAAiB,QAAqC;AAChE,UAAM,OAAO;AACb,SAAK,SAAS;AAAA,EAChB;AACF;AAQA,SAAS,yBACP,UACa;AACb,QAAM,eAAe,SAAS,MAAM;AACpC,SAAO,aAAa,OAAO,OAAO;AAIlC,eAAa,QAAQ,gBAAgB,aAAa,MAAM;AACxD,SAAO;AACT;AAQA,eAAsB,gBACpB,OACiB;AACjB,QAAM,EAAE,UAAU,YAAY,SAAS,gBAAgB,kBAAkB,IACvE;AAEF,QAAM,MAAM;AAAA,IACV,yBAAyB,QAAQ;AAAA,IACjC;AAAA,IACA;AAAA,IACA,GAAG;AAAA,IACH,GAAG;AAAA,EACL,EAAE,OAAO,CAAC,SAAS,SAAS,MAAS;AAErC,SAAO,OAAO,OAAO,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M,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF;","names":["SnapStatus","SnapStatusEvents"]} -\ No newline at end of file -+{"version":3,"sources":["../src/snaps.ts"],"sourcesContent":["import type {\n Caveat,\n SubjectPermissions,\n PermissionConstraint,\n} from '@metamask/permission-controller';\nimport type { BlockReason } from '@metamask/snaps-registry';\nimport type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk';\nimport type { Json } from '@metamask/utils';\nimport { assert, isObject, assertStruct } from '@metamask/utils';\nimport { base64 } from '@scure/base';\nimport stableStringify from 'fast-json-stable-stringify';\nimport type { Struct } from '@metamask/superstruct';\nimport {\n empty,\n enums,\n intersection,\n literal,\n pattern,\n refine,\n string,\n union,\n validate,\n} from '@metamask/superstruct';\nimport validateNPMPackage from 'validate-npm-package-name';\n\nimport { SnapCaveatType } from './caveats';\nimport { checksumFiles } from './checksum';\nimport type { LocalizationFile } from './localization';\nimport type {\n InitialConnections,\n SnapManifest,\n SnapPermissions,\n} from './manifest/validation';\nimport type { FetchedSnapFiles, SnapsPermissionRequest } from './types';\nimport { SnapIdPrefixes, SnapValidationFailureReason, uri } from './types';\nimport type { VirtualFile } from './virtual-file';\n\n// This RegEx matches valid npm package names (with some exceptions) and space-\n// separated alphanumerical words, optionally with dashes and underscores.\n// The RegEx consists of two parts. The first part matches space-separated\n// words. It is based on the following Stackoverflow answer:\n// https://stackoverflow.com/a/34974982\n// The second part, after the pipe operator, is the same RegEx used for the\n// `name` field of the official package.json JSON Schema, except that we allow\n// mixed-case letters. It was originally copied from:\n// https://github.com/SchemaStore/schemastore/blob/81a16897c1dabfd98c72242a5fd62eb080ff76d8/src/schemas/json/package.json#L132-L138\nexport const PROPOSED_NAME_REGEX =\n /^(?:[A-Za-z0-9-_]+( [A-Za-z0-9-_]+)*)|(?:(?:@[A-Za-z0-9-*~][A-Za-z0-9-*._~]*\\/)?[A-Za-z0-9-~][A-Za-z0-9-._~]*)$/u;\n\nexport enum SnapStatus {\n Installing = 'installing',\n Updating = 'updating',\n Running = 'running',\n Stopped = 'stopped',\n Crashed = 'crashed',\n}\n\nexport enum SnapStatusEvents {\n Start = 'START',\n Stop = 'STOP',\n Crash = 'CRASH',\n Update = 'UPDATE',\n}\n\nexport type StatusContext = { snapId: SnapId };\nexport type StatusEvents = { type: SnapStatusEvents };\nexport type StatusStates = {\n value: SnapStatus;\n context: StatusContext;\n};\nexport type Status = StatusStates['value'];\n\nexport type VersionHistory = {\n origin: string;\n version: string;\n // Unix timestamp\n date: number;\n};\n\nexport type SnapAuxilaryFile = {\n path: string;\n // Value here should be stored as base64\n value: string;\n};\n\nexport type PersistedSnap = Snap;\n\n/**\n * A Snap as it exists in {@link SnapController} state.\n */\nexport type Snap = TruncatedSnap & {\n /**\n * The initial connections of the Snap, optional, requested on installation.\n */\n initialConnections?: InitialConnections;\n /**\n * The initial permissions of the Snap, which will be requested when it is\n * installed.\n */\n initialPermissions: SnapPermissions;\n\n /**\n * The source code of the Snap.\n */\n sourceCode: string;\n\n /**\n * The Snap's manifest file.\n */\n manifest: SnapManifest;\n\n /**\n * Information detailing why the snap is blocked.\n */\n blockInformation?: BlockReason;\n\n /**\n * The current status of the Snap, e.g. whether it's running or stopped.\n */\n status: Status;\n\n /**\n * The version history of the Snap.\n * Can be used to derive when the Snap was installed, when it was updated to a certain version and who requested the change.\n */\n versionHistory: VersionHistory[];\n\n /**\n * Static auxiliary files that can be loaded at runtime.\n */\n auxiliaryFiles?: SnapAuxilaryFile[];\n\n /**\n * Localization files which are used to translate the manifest.\n */\n localizationFiles?: LocalizationFile[];\n\n /**\n * Flag to signal whether this snap was preinstalled or not.\n *\n * A lack of specifying this option will be deemed as not preinstalled.\n */\n preinstalled?: boolean;\n\n /**\n * Flag to signal whether this snap is removable or not.\n *\n * A lack of specifying this option will be deemed as removable.\n */\n removable?: boolean;\n\n /**\n * Flag to signal whether this snap should be hidden from the user or not.\n */\n hidden?: boolean;\n};\n\nexport type TruncatedSnapFields =\n | 'id'\n | 'initialPermissions'\n | 'version'\n | 'enabled'\n | 'blocked';\n\n/**\n * An error indicating that a Snap validation failure is programmatically\n * fixable during development.\n */\nexport class ProgrammaticallyFixableSnapError extends Error {\n reason: SnapValidationFailureReason;\n\n constructor(message: string, reason: SnapValidationFailureReason) {\n super(message);\n this.reason = reason;\n }\n}\n\n/**\n * Gets a checksummable manifest by removing the shasum property and reserializing the JSON using a deterministic algorithm.\n *\n * @param manifest - The manifest itself.\n * @returns A virtual file containing the checksummable manifest.\n */\nfunction getChecksummableManifest(\n manifest: VirtualFile,\n): VirtualFile {\n const manifestCopy = manifest.clone() as VirtualFile;\n delete manifestCopy.result.source.shasum;\n\n // We use fast-json-stable-stringify to deterministically serialize the JSON\n // This is required before checksumming so we get reproducible checksums across platforms etc\n manifestCopy.value = stableStringify(manifestCopy.result);\n return manifestCopy;\n}\n\n/**\n * Calculates the Base64-encoded SHA-256 digest of all required Snap files.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @returns The Base64-encoded SHA-256 digest of the source code.\n */\nexport async function getSnapChecksum(\n files: FetchedSnapFiles,\n): Promise {\n const { manifest, sourceCode, svgIcon, auxiliaryFiles, localizationFiles } =\n files;\n\n const all = [\n getChecksummableManifest(manifest),\n sourceCode,\n svgIcon,\n ...auxiliaryFiles,\n ...localizationFiles,\n ].filter((file) => file !== undefined);\n\n return base64.encode(await checksumFiles(all as VirtualFile[]));\n}\n\n/**\n * Checks whether the `source.shasum` property of a Snap manifest matches the\n * shasum of the snap.\n *\n * @param files - All required Snap files to be included in the checksum.\n * @param errorMessage - The error message to throw if validation fails.\n */\nexport async function validateSnapShasum(\n files: FetchedSnapFiles,\n errorMessage = 'Invalid Snap manifest: manifest shasum does not match computed shasum.',\n): Promise {\n if (files.manifest.result.source.shasum !== (await getSnapChecksum(files))) {\n throw new ProgrammaticallyFixableSnapError(\n errorMessage,\n SnapValidationFailureReason.ShasumMismatch,\n );\n }\n}\n\nexport const LOCALHOST_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]'] as const;\n\n// Require snap ids to only consist of printable ASCII characters\nexport const BaseSnapIdStruct = pattern(string(), /^[\\x21-\\x7E]*$/u);\n\nconst LocalSnapIdSubUrlStruct = uri({\n protocol: enums(['http:', 'https:']),\n hostname: enums(LOCALHOST_HOSTNAMES),\n hash: empty(string()),\n search: empty(string()),\n});\n\nexport const LocalSnapIdStruct = refine(\n BaseSnapIdStruct,\n 'local Snap Id',\n (value) => {\n if (!value.startsWith(SnapIdPrefixes.local)) {\n return `Expected local snap ID, got \"${value}\".`;\n }\n\n const [error] = validate(\n value.slice(SnapIdPrefixes.local.length),\n LocalSnapIdSubUrlStruct,\n );\n return error ?? true;\n },\n);\nexport const NpmSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: literal(SnapIdPrefixes.npm),\n pathname: refine(string(), 'package name', function* (value) {\n const normalized = value.startsWith('/') ? value.slice(1) : value;\n const { errors, validForNewPackages, warnings } =\n validateNPMPackage(normalized);\n if (!validForNewPackages) {\n if (errors === undefined) {\n assert(warnings !== undefined);\n yield* warnings;\n } else {\n yield* errors;\n }\n }\n return true;\n }),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const HttpSnapIdStruct = intersection([\n BaseSnapIdStruct,\n uri({\n protocol: enums(['http:', 'https:']),\n search: empty(string()),\n hash: empty(string()),\n }),\n]) as unknown as Struct;\n\nexport const SnapIdStruct = union([NpmSnapIdStruct, LocalSnapIdStruct]);\n\n/**\n * Extracts the snap prefix from a snap ID.\n *\n * @param snapId - The snap ID to extract the prefix from.\n * @returns The snap prefix from a snap id, e.g. `npm:`.\n */\nexport function getSnapPrefix(snapId: string): SnapIdPrefixes {\n const prefix = Object.values(SnapIdPrefixes).find((possiblePrefix) =>\n snapId.startsWith(possiblePrefix),\n );\n if (prefix !== undefined) {\n return prefix;\n }\n throw new Error(`Invalid or no prefix found for \"${snapId}\"`);\n}\n\n/**\n * Strips snap prefix from a full snap ID.\n *\n * @param snapId - The snap ID to strip.\n * @returns The stripped snap ID.\n */\nexport function stripSnapPrefix(snapId: string): string {\n return snapId.replace(getSnapPrefix(snapId), '');\n}\n\n/**\n * Assert that the given value is a valid snap ID.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid snap ID.\n */\nexport function assertIsValidSnapId(value: unknown): asserts value is SnapId {\n assertStruct(value, SnapIdStruct, 'Invalid snap ID');\n}\n\n/**\n * Typeguard to ensure a chainId follows the CAIP-2 standard.\n *\n * @param chainId - The chainId being tested.\n * @returns `true` if the value is a valid CAIP chain id, and `false` otherwise.\n */\nexport function isCaipChainId(chainId: unknown): chainId is string {\n return (\n typeof chainId === 'string' &&\n /^(?[-a-z0-9]{3,8}):(?[-a-zA-Z0-9]{1,32})$/u.test(\n chainId,\n )\n );\n}\n\n/**\n * Utility function to check if an origin has permission (and caveat) for a particular snap.\n *\n * @param permissions - An origin's permissions object.\n * @param snapId - The id of the snap.\n * @returns A boolean based on if an origin has the specified snap.\n */\nexport function isSnapPermitted(\n permissions: SubjectPermissions,\n snapId: SnapId,\n) {\n return Boolean(\n (\n (\n (permissions?.wallet_snap?.caveats?.find(\n (caveat) => caveat.type === SnapCaveatType.SnapIds,\n ) ?? {}) as Caveat\n ).value as Record\n )?.[snapId],\n );\n}\n\n/**\n * Checks whether the passed in requestedPermissions is a valid\n * permission request for a `wallet_snap` permission.\n *\n * @param requestedPermissions - The requested permissions.\n * @throws If the criteria is not met.\n */\nexport function verifyRequestedSnapPermissions(\n requestedPermissions: unknown,\n): asserts requestedPermissions is SnapsPermissionRequest {\n assert(\n isObject(requestedPermissions),\n 'Requested permissions must be an object.',\n );\n\n const { wallet_snap: walletSnapPermission } = requestedPermissions;\n\n assert(\n isObject(walletSnapPermission),\n 'wallet_snap is missing from the requested permissions.',\n );\n\n const { caveats } = walletSnapPermission;\n\n assert(\n Array.isArray(caveats) && caveats.length === 1,\n 'wallet_snap must have a caveat property with a single-item array value.',\n );\n\n const [caveat] = caveats;\n\n assert(\n isObject(caveat) &&\n caveat.type === SnapCaveatType.SnapIds &&\n isObject(caveat.value),\n `The requested permissions do not have a valid ${SnapCaveatType.SnapIds} caveat.`,\n );\n}\n\nexport type { Snap as TruncatedSnap } from '@metamask/snaps-sdk';\n"],"mappings":";;;;;;;;;AAQA,SAAS,QAAQ,UAAU,oBAAoB;AAC/C,SAAS,cAAc;AACvB,OAAO,qBAAqB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAuBxB,IAAM,sBACX;AAEK,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,mBAAL,kBAAKC,sBAAL;AACL,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AA+GL,IAAM,mCAAN,cAA+C,MAAM;AAAA,EAG1D,YAAY,SAAiB,QAAqC;AAChE,UAAM,OAAO;AACb,SAAK,SAAS;AAAA,EAChB;AACF;AAQA,SAAS,yBACP,UACa;AACb,QAAM,eAAe,SAAS,MAAM;AACpC,SAAO,aAAa,OAAO,OAAO;AAIlC,eAAa,QAAQ,gBAAgB,aAAa,MAAM;AACxD,SAAO;AACT;AAQA,eAAsB,gBACpB,OACiB;AACjB,QAAM,EAAE,UAAU,YAAY,SAAS,gBAAgB,kBAAkB,IACvE;AAEF,QAAM,MAAM;AAAA,IACV,yBAAyB,QAAQ;AAAA,IACjC;AAAA,IACA;AAAA,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,IAAI;AAEpB;AAAA,IACE,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW;AAAA,IAC7C;AAAA,EACF;AAEA,QAAM,CAAC,MAAM,IAAI;AAEjB;AAAA,IACE,SAAS,MAAM,KACb,OAAO,oCACP,SAAS,OAAO,KAAK;AAAA,IACvB,wEAAuE;AAAA,EACzE;AACF;","names":["SnapStatus","SnapStatusEvents"]} -\ No newline at end of file -diff --git a/dist/chunk-ZJKG5Q2C.js.map b/dist/chunk-ZJKG5Q2C.js.map -index 913794892e5f673c8d0c13691e6c3f6429d14867..fd057e45b69a442d17b721703c2f57dda2f817c5 100644 ---- a/dist/chunk-ZJKG5Q2C.js.map -+++ b/dist/chunk-ZJKG5Q2C.js.map -@@ -1 +1 @@ --{"version":3,"sources":["../src/manifest/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP,IAAM,qBAA+B;AAAA,EACnC;AAAA,EACA;AACF;AAEO,IAAM,uBAAiC,CAAC,EAAE;AACjD,IAAM,kBAA8B,qBAAqB,IAAI,CAAC,aAAa;AAAA,EACzE;AAAA,EACA;AAAA,EACA,GAAG,QAAQ;AACb,CAAC;AAEM,IAAM,kBAAkB;AAAA,EAC7B,MAAM,OAAO,CAAC;AAAA,EACd;AAAA,EACA,CAAC,SAAmB;AAClB,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,QAAI,KAAK,CAAC,MAAM,KAAK;AACnB,aAAO;AAAA,IACT;AAEA,QA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IACV,OAAO;AAAA,MACL,MAAM,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,MAChC,KAAK,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,IACjC,CAAC;AAAA,EACH;AAAA,EACA,QAAQ,OAAO;AAAA,IACb,QAAQ;AAAA,IACR,UAAU,OAAO;AAAA,MACf,KAAK,OAAO;AAAA,QACV,UAAU,KAAK,OAAO,GAAG,GAAG,QAAQ;AAAA,QACpC,UAAU,SAAS,KAAK,OAAO,GAAG,GAAG,QAAQ,CAAC;AAAA,QAC9C,aAAa;AAAA,QACb,UAAU,MAAM;AAAA,UACd,QAAQ,4BAA4B;AAAA,UACpC,QAAQ,6BAA6B;AAAA,QACvC,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,IACD,OAAO,SAAS,uBAAuB;AAAA,IACvC,SAAS,SAAS,uBAAuB;AAAA,EAC3C,CAAC;AAAA,EACD,oBAAoB,SAAS,wBAAwB;AAAA,EACrD,oBAAoB;AAAA,EACpB,iBAAiB,QAAQ,KAAK;AAAA,EAC9B,SAAS,SAAS,OAAO,CAAC;AAAA;AAC5B,CAAC;AAUM,SAAS,eAAe,OAAuC;AACpE,SAAO,GAAG,OAAO,kBAAkB;AACrC;AAQO,SAAS,qBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from 'superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from 'superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"]} -\ No newline at end of file -+{"version":3,"sources":["../src/manifest/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,+BAA+B;AAExC;A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,oBAAoB,SAAS,wBAAwB;AAAA,EACrD,oBAAoB;AAAA,EACpB,iBAAiB,QAAQ,KAAK;AAAA,EAC9B,SAAS,SAAS,OAAO,CAAC;AAAA;AAC5B,CAAC;AAUM,SAAS,eAAe,OAAuC;AACpE,SAAO,GAAG,OAAO,kBAAkB;AACrC;AAQO,SAAS,qBACd,OAC+B;AAC/B;AAAA,IACE;AAAA,IACA;AAAA,IACA,uCAA6B;AAAA,EAC/B;AACF;AASO,SAAS,mBAAmB,OAA8B;AAE/D,SAAO,OAAO,OAAO,kBAAkB;AACzC","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport { isValidBIP32PathSegment } from '@metamask/key-tree';\nimport type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk';\nimport {\n assertStruct,\n ChecksumStruct,\n VersionStruct,\n isValidSemVerRange,\n inMilliseconds,\n Duration,\n} from '@metamask/utils';\nimport type { Describe, Infer, Struct } from '@metamask/superstruct';\nimport {\n array,\n boolean,\n create,\n enums,\n integer,\n is,\n literal,\n object,\n optional,\n refine,\n record,\n size,\n string,\n type,\n union,\n intersection,\n} from '@metamask/superstruct';\n\nimport { isEqual } from '../array';\nimport { CronjobSpecificationArrayStruct } from '../cronjob';\nimport { SIP_6_MAGIC_VALUE, STATE_ENCRYPTION_MAGIC_VALUE } from '../entropy';\nimport { KeyringOriginsStruct, RpcOriginsStruct } from '../json-rpc';\nimport { ChainIdStruct } from '../namespace';\nimport { SnapIdStruct } from '../snaps';\nimport { mergeStructs, type InferMatching } from '../structs';\nimport { NameStruct, NpmSnapFileNames, uri } from '../types';\n\n// BIP-43 purposes that cannot be used for entropy derivation. These are in the\n// string form, ending with `'`.\nconst FORBIDDEN_PURPOSES: string[] = [\n SIP_6_MAGIC_VALUE,\n STATE_ENCRYPTION_MAGIC_VALUE,\n];\n\nexport const FORBIDDEN_COIN_TYPES: number[] = [60];\nconst FORBIDDEN_PATHS: string[][] = FORBIDDEN_COIN_TYPES.map((coinType) => [\n 'm',\n \"44'\",\n `${coinType}'`,\n]);\n\nexport const Bip32PathStruct = refine(\n array(string()),\n 'BIP-32 path',\n (path: string[]) => {\n if (path.length === 0) {\n return 'Path must be a non-empty BIP-32 derivation path array';\n }\n\n if (path[0] !== 'm') {\n return 'Path must start with \"m\".';\n }\n\n if (path.length < 3) {\n return 'Paths must have a length of at least three.';\n }\n\n if (path.slice(1).some((part) => !isValidBIP32PathSegment(part))) {\n return 'Path must be a valid BIP-32 derivation path array.';\n }\n\n if (FORBIDDEN_PURPOSES.includes(path[1])) {\n return `The purpose \"${path[1]}\" is not allowed for entropy derivation.`;\n }\n\n if (\n FORBIDDEN_PATHS.some((forbiddenPath) =>\n isEqual(path.slice(0, forbiddenPath.length), forbiddenPath),\n )\n ) {\n return `The path \"${path.join(\n '/',\n )}\" is not allowed for entropy derivation.`;\n }\n\n return true;\n },\n);\n\nexport const bip32entropy = <\n Type extends { path: string[]; curve: string },\n Schema,\n>(\n struct: Struct,\n) =>\n refine(struct, 'BIP-32 entropy', (value) => {\n if (\n value.curve === 'ed25519' &&\n value.path.slice(1).some((part) => !part.endsWith(\"'\"))\n ) {\n return 'Ed25519 does not support unhardened paths.';\n }\n\n return true;\n });\n\nexport const CurveStruct: Describe = enums([\n 'ed25519',\n 'secp256k1',\n 'ed25519Bip32',\n]);\n\n// Used outside @metamask/snap-utils\nexport const Bip32EntropyStruct = bip32entropy(\n type({\n path: Bip32PathStruct,\n curve: CurveStruct,\n }),\n);\n\nexport type Bip32Entropy = Infer;\n\nexport const SnapGetBip32EntropyPermissionsStruct = size(\n array(Bip32EntropyStruct),\n 1,\n Infinity,\n);\n\nexport const SemVerRangeStruct = refine(string(), 'SemVer range', (value) => {\n if (isValidSemVerRange(value)) {\n return true;\n }\n return 'Expected a valid SemVer range.';\n});\n\nexport const SnapIdsStruct = refine(\n record(SnapIdStruct, object({ version: optional(SemVerRangeStruct) })),\n 'SnapIds',\n (value) => {\n if (Object.keys(value).length === 0) {\n return false;\n }\n\n return true;\n },\n);\n\nexport type SnapIds = Infer;\n\nexport const ChainIdsStruct = size(array(ChainIdStruct), 1, Infinity);\n\nexport const LookupMatchersStruct = union([\n object({\n tlds: size(array(string()), 1, Infinity),\n }),\n object({\n schemes: size(array(string()), 1, Infinity),\n }),\n object({\n tlds: size(array(string()), 1, Infinity),\n schemes: size(array(string()), 1, Infinity),\n }),\n]);\n\nexport const MINIMUM_REQUEST_TIMEOUT = inMilliseconds(5, Duration.Second);\nexport const MAXIMUM_REQUEST_TIMEOUT = inMilliseconds(3, Duration.Minute);\n\nexport const MaxRequestTimeStruct = size(\n integer(),\n MINIMUM_REQUEST_TIMEOUT,\n MAXIMUM_REQUEST_TIMEOUT,\n);\n\n// Utility type to union with for all handler structs\nexport const HandlerCaveatsStruct = object({\n maxRequestTime: optional(MaxRequestTimeStruct),\n});\n\nexport type HandlerCaveats = Infer;\n\nexport const EmptyObjectStruct = object({}) as unknown as Struct<\n EmptyObject,\n null\n>;\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const PermissionsStruct: Describe = type({\n 'endowment:cronjob': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({ jobs: CronjobSpecificationArrayStruct }),\n ),\n ),\n 'endowment:ethereum-provider': optional(EmptyObjectStruct),\n 'endowment:keyring': optional(\n mergeStructs(HandlerCaveatsStruct, KeyringOriginsStruct),\n ),\n 'endowment:lifecycle-hooks': optional(HandlerCaveatsStruct),\n 'endowment:name-lookup': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n chains: optional(ChainIdsStruct),\n matchers: optional(LookupMatchersStruct),\n }),\n ),\n ),\n 'endowment:network-access': optional(EmptyObjectStruct),\n 'endowment:page-home': optional(HandlerCaveatsStruct),\n 'endowment:rpc': optional(\n mergeStructs(HandlerCaveatsStruct, RpcOriginsStruct),\n ),\n 'endowment:signature-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowSignatureOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:transaction-insight': optional(\n mergeStructs(\n HandlerCaveatsStruct,\n object({\n allowTransactionOrigin: optional(boolean()),\n }),\n ),\n ),\n 'endowment:webassembly': optional(EmptyObjectStruct),\n snap_dialog: optional(EmptyObjectStruct),\n snap_manageState: optional(EmptyObjectStruct),\n snap_manageAccounts: optional(EmptyObjectStruct),\n snap_notify: optional(EmptyObjectStruct),\n snap_getBip32Entropy: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip32PublicKey: optional(SnapGetBip32EntropyPermissionsStruct),\n snap_getBip44Entropy: optional(\n size(\n array(object({ coinType: size(integer(), 0, 2 ** 32 - 1) })),\n 1,\n Infinity,\n ),\n ),\n snap_getEntropy: optional(EmptyObjectStruct),\n snap_getLocale: optional(EmptyObjectStruct),\n wallet_snap: optional(SnapIdsStruct),\n});\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type SnapPermissions = InferMatching<\n typeof PermissionsStruct,\n InitialPermissions\n>;\n\nexport const SnapAuxilaryFilesStruct = array(string());\n\nexport const InitialConnectionsStruct = record(\n intersection([string(), uri()]),\n object({}),\n);\n\nexport type InitialConnections = Infer;\n\nexport const SnapManifestStruct = object({\n version: VersionStruct,\n description: size(string(), 1, 280),\n proposedName: size(string(), 1, 214),\n repository: optional(\n object({\n type: size(string(), 1, Infinity),\n url: size(string(), 1, Infinity),\n }),\n ),\n source: object({\n shasum: ChecksumStruct,\n location: object({\n npm: object({\n filePath: size(string(), 1, Infinity),\n iconPath: optional(size(string(), 1, Infinity)),\n packageName: NameStruct,\n registry: union([\n literal('https://registry.npmjs.org'),\n literal('https://registry.npmjs.org/'),\n ]),\n }),\n }),\n files: optional(SnapAuxilaryFilesStruct),\n locales: optional(SnapAuxilaryFilesStruct),\n }),\n initialConnections: optional(InitialConnectionsStruct),\n initialPermissions: PermissionsStruct,\n manifestVersion: literal('0.1'),\n $schema: optional(string()), // enables JSON-Schema linting in VSC and other IDEs\n});\n\nexport type SnapManifest = Infer;\n\n/**\n * Check if the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @returns Whether the value is a valid {@link SnapManifest} object.\n */\nexport function isSnapManifest(value: unknown): value is SnapManifest {\n return is(value, SnapManifestStruct);\n}\n\n/**\n * Assert that the given value is a valid {@link SnapManifest} object.\n *\n * @param value - The value to check.\n * @throws If the value is not a valid {@link SnapManifest} object.\n */\nexport function assertIsSnapManifest(\n value: unknown,\n): asserts value is SnapManifest {\n assertStruct(\n value,\n SnapManifestStruct,\n `\"${NpmSnapFileNames.Manifest}\" is invalid`,\n );\n}\n\n/**\n * Creates a {@link SnapManifest} object from JSON.\n *\n * @param value - The value to check.\n * @throws If the value cannot be coerced to a {@link SnapManifest} object.\n * @returns The created {@link SnapManifest} object.\n */\nexport function createSnapManifest(value: unknown): SnapManifest {\n // TODO: Add a utility to prefix these errors similar to assertStruct\n return create(value, SnapManifestStruct);\n}\n"]} -\ No newline at end of file -diff --git a/dist/types/cronjob.d.ts b/dist/types/cronjob.d.ts -index bbd2e815e1a5291aa4e4424092f0733de29a9615..ba11906cdfc68042627ed2a7cc077ce397586f23 100644 ---- a/dist/types/cronjob.d.ts -+++ b/dist/types/cronjob.d.ts -@@ -1,17 +1,17 @@ --import type { Infer } from 'superstruct'; --export declare const CronjobRpcRequestStruct: import("superstruct").Struct<{ -+import type { Infer } from '@metamask/superstruct'; -+export declare const CronjobRpcRequestStruct: import("@metamask/superstruct").Struct<{ - method: string; - id?: string | number | null | undefined; - jsonrpc?: "2.0" | undefined; - params?: Record | import("@metamask/utils").Json[] | undefined; - }, { -- jsonrpc: import("superstruct").Struct<"2.0" | undefined, "2.0">; -- id: import("superstruct").Struct; -- method: import("superstruct").Struct; -- params: import("superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; -+ jsonrpc: import("@metamask/superstruct").Struct<"2.0" | undefined, "2.0">; -+ id: import("@metamask/superstruct").Struct; -+ method: import("@metamask/superstruct").Struct; -+ params: import("@metamask/superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; - }>; - export declare type CronjobRpcRequest = Infer; --export declare const CronExpressionStruct: import("superstruct").Struct; -+export declare const CronExpressionStruct: import("@metamask/superstruct").Struct; - export declare type CronExpression = Infer; - /** - * Parses a cron expression. -@@ -20,7 +20,7 @@ export declare type CronExpression = Infer; - * @returns A CronExpression class instance. - */ - export declare function parseCronExpression(expression: string | object): import("cron-parser").CronExpression; --export declare const CronjobSpecificationStruct: import("superstruct").Struct<{ -+export declare const CronjobSpecificationStruct: import("@metamask/superstruct").Struct<{ - request: { - method: string; - id?: string | number | null | undefined; -@@ -29,17 +29,17 @@ export declare const CronjobSpecificationStruct: import("superstruct").Struct<{ - }; - expression: string; - }, { -- expression: import("superstruct").Struct; -- request: import("superstruct").Struct<{ -+ expression: import("@metamask/superstruct").Struct; -+ request: import("@metamask/superstruct").Struct<{ - method: string; - id?: string | number | null | undefined; - jsonrpc?: "2.0" | undefined; - params?: Record | import("@metamask/utils").Json[] | undefined; - }, { -- jsonrpc: import("superstruct").Struct<"2.0" | undefined, "2.0">; -- id: import("superstruct").Struct; -- method: import("superstruct").Struct; -- params: import("superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; -+ jsonrpc: import("@metamask/superstruct").Struct<"2.0" | undefined, "2.0">; -+ id: import("@metamask/superstruct").Struct; -+ method: import("@metamask/superstruct").Struct; -+ params: import("@metamask/superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; - }>; - }>; - export declare type CronjobSpecification = Infer; -@@ -50,7 +50,7 @@ export declare type CronjobSpecification = Infer | import("@metamask/utils").Json[] | undefined; - }; - expression: string; --}[], import("superstruct").Struct<{ -+}[], import("@metamask/superstruct").Struct<{ - request: { - method: string; - id?: string | number | null | undefined; -@@ -67,17 +67,17 @@ export declare const CronjobSpecificationArrayStruct: import("superstruct").Stru - }; - expression: string; - }, { -- expression: import("superstruct").Struct; -- request: import("superstruct").Struct<{ -+ expression: import("@metamask/superstruct").Struct; -+ request: import("@metamask/superstruct").Struct<{ - method: string; - id?: string | number | null | undefined; - jsonrpc?: "2.0" | undefined; - params?: Record | import("@metamask/utils").Json[] | undefined; - }, { -- jsonrpc: import("superstruct").Struct<"2.0" | undefined, "2.0">; -- id: import("superstruct").Struct; -- method: import("superstruct").Struct; -- params: import("superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; -+ jsonrpc: import("@metamask/superstruct").Struct<"2.0" | undefined, "2.0">; -+ id: import("@metamask/superstruct").Struct; -+ method: import("@metamask/superstruct").Struct; -+ params: import("@metamask/superstruct").Struct | import("@metamask/utils").Json[] | undefined, null>; - }>; - }>>; - /** -diff --git a/dist/types/handlers.d.ts b/dist/types/handlers.d.ts -index e271e2cf2b00a6c0191fbbd241508a2843245056..51263fb1b8025fe075f1f1a3d9b11cc7a3fb45bc 100644 ---- a/dist/types/handlers.d.ts -+++ b/dist/types/handlers.d.ts -@@ -59,19 +59,19 @@ export declare const SNAP_EXPORTS: { - readonly validator: (snapExport: unknown) => snapExport is OnUserInputHandler; - }; - }; --export declare const OnTransactionSeverityResponseStruct: import("superstruct").Struct<{ -+export declare const OnTransactionSeverityResponseStruct: import("@metamask/superstruct").Struct<{ - severity?: SeverityLevel | undefined; - }, { -- severity: import("superstruct").Struct; -+ severity: import("@metamask/superstruct").Struct; - }>; --export declare const OnTransactionResponseWithIdStruct: import("superstruct").Struct<{ -+export declare const OnTransactionResponseWithIdStruct: import("@metamask/superstruct").Struct<{ - id: string; - severity?: SeverityLevel | undefined; - }, { -- id: import("superstruct").Struct; -- severity: import("superstruct").Struct; -+ id: import("@metamask/superstruct").Struct; -+ severity: import("@metamask/superstruct").Struct; - }>; --export declare const OnTransactionResponseWithContentStruct: import("superstruct").Struct<{ -+export declare const OnTransactionResponseWithContentStruct: import("@metamask/superstruct").Struct<{ - content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { - value: string; - type: import("@metamask/snaps-sdk").NodeType.Copyable; -@@ -148,7 +148,7 @@ export declare const OnTransactionResponseWithContentStruct: import("superstruct - }, "Image">; - severity?: SeverityLevel | undefined; - }, { -- content: import("superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { -+ content: import("@metamask/superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { - value: string; - type: import("@metamask/snaps-sdk").NodeType.Copyable; - sensitive?: boolean | undefined; -@@ -222,9 +222,9 @@ export declare const OnTransactionResponseWithContentStruct: import("superstruct - src: string; - alt?: string | undefined; - }, "Image">, null>; -- severity: import("superstruct").Struct; -+ severity: import("@metamask/superstruct").Struct; - }>; --export declare const OnTransactionResponseStruct: import("superstruct").Struct<{ -+export declare const OnTransactionResponseStruct: import("@metamask/superstruct").Struct<{ - id: string; - severity?: SeverityLevel | undefined; - } | { -@@ -304,7 +304,7 @@ export declare const OnTransactionResponseStruct: import("superstruct").Struct<{ - }, "Image">; - severity?: SeverityLevel | undefined; - } | null, null>; --export declare const OnSignatureResponseStruct: import("superstruct").Struct<{ -+export declare const OnSignatureResponseStruct: import("@metamask/superstruct").Struct<{ - id: string; - severity?: SeverityLevel | undefined; - } | { -@@ -384,7 +384,7 @@ export declare const OnSignatureResponseStruct: import("superstruct").Struct<{ - }, "Image">; - severity?: SeverityLevel | undefined; - } | null, null>; --export declare const OnHomePageResponseWithContentStruct: import("superstruct").Struct<{ -+export declare const OnHomePageResponseWithContentStruct: import("@metamask/superstruct").Struct<{ - content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { - value: string; - type: import("@metamask/snaps-sdk").NodeType.Copyable; -@@ -460,7 +460,7 @@ export declare const OnHomePageResponseWithContentStruct: import("superstruct"). - alt?: string | undefined; - }, "Image">; - }, { -- content: import("superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { -+ content: import("@metamask/superstruct").Struct | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { - value: string; - type: import("@metamask/snaps-sdk").NodeType.Copyable; - sensitive?: boolean | undefined; -@@ -535,12 +535,12 @@ export declare const OnHomePageResponseWithContentStruct: import("superstruct"). - alt?: string | undefined; - }, "Image">, null>; - }>; --export declare const OnHomePageResponseWithIdStruct: import("superstruct").Struct<{ -+export declare const OnHomePageResponseWithIdStruct: import("@metamask/superstruct").Struct<{ - id: string; - }, { -- id: import("superstruct").Struct; -+ id: import("@metamask/superstruct").Struct; - }>; --export declare const OnHomePageResponseStruct: import("superstruct").Struct<{ -+export declare const OnHomePageResponseStruct: import("@metamask/superstruct").Struct<{ - content: import("@metamask/snaps-sdk").Panel | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Divider"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement, "Spinner"> | import("@metamask/snaps-sdk/jsx").SnapElement | import("@metamask/snaps-sdk/jsx").SnapElement | { - value: string; - type: import("@metamask/snaps-sdk").NodeType.Copyable; -@@ -618,61 +618,61 @@ export declare const OnHomePageResponseStruct: import("superstruct").Struct<{ - } | { - id: string; - }, null>; --export declare const AddressResolutionStruct: import("superstruct").Struct<{ -+export declare const AddressResolutionStruct: import("@metamask/superstruct").Struct<{ - protocol: string; - resolvedDomain: string; - }, { -- protocol: import("superstruct").Struct; -- resolvedDomain: import("superstruct").Struct; -+ protocol: import("@metamask/superstruct").Struct; -+ resolvedDomain: import("@metamask/superstruct").Struct; - }>; --export declare const DomainResolutionStruct: import("superstruct").Struct<{ -+export declare const DomainResolutionStruct: import("@metamask/superstruct").Struct<{ - protocol: string; - resolvedAddress: string; - domainName: string; - }, { -- protocol: import("superstruct").Struct; -- resolvedAddress: import("superstruct").Struct; -- domainName: import("superstruct").Struct; -+ protocol: import("@metamask/superstruct").Struct; -+ resolvedAddress: import("@metamask/superstruct").Struct; -+ domainName: import("@metamask/superstruct").Struct; - }>; --export declare const AddressResolutionResponseStruct: import("superstruct").Struct<{ -+export declare const AddressResolutionResponseStruct: import("@metamask/superstruct").Struct<{ - resolvedDomains: { - protocol: string; - resolvedDomain: string; - }[]; - }, { -- resolvedDomains: import("superstruct").Struct<{ -+ resolvedDomains: import("@metamask/superstruct").Struct<{ - protocol: string; - resolvedDomain: string; -- }[], import("superstruct").Struct<{ -+ }[], import("@metamask/superstruct").Struct<{ - protocol: string; - resolvedDomain: string; - }, { -- protocol: import("superstruct").Struct; -- resolvedDomain: import("superstruct").Struct; -+ protocol: import("@metamask/superstruct").Struct; -+ resolvedDomain: import("@metamask/superstruct").Struct; - }>>; - }>; --export declare const DomainResolutionResponseStruct: import("superstruct").Struct<{ -+export declare const DomainResolutionResponseStruct: import("@metamask/superstruct").Struct<{ - resolvedAddresses: { - protocol: string; - resolvedAddress: string; - domainName: string; - }[]; - }, { -- resolvedAddresses: import("superstruct").Struct<{ -+ resolvedAddresses: import("@metamask/superstruct").Struct<{ - protocol: string; - resolvedAddress: string; - domainName: string; -- }[], import("superstruct").Struct<{ -+ }[], import("@metamask/superstruct").Struct<{ - protocol: string; - resolvedAddress: string; - domainName: string; - }, { -- protocol: import("superstruct").Struct; -- resolvedAddress: import("superstruct").Struct; -- domainName: import("superstruct").Struct; -+ protocol: import("@metamask/superstruct").Struct; -+ resolvedAddress: import("@metamask/superstruct").Struct; -+ domainName: import("@metamask/superstruct").Struct; - }>>; - }>; --export declare const OnNameLookupResponseStruct: import("superstruct").Struct<{ -+export declare const OnNameLookupResponseStruct: import("@metamask/superstruct").Struct<{ - resolvedDomains: { - protocol: string; - resolvedDomain: string; -diff --git a/dist/types/json-rpc.d.ts b/dist/types/json-rpc.d.ts -index 38718479d623d46c3d8642c4657cab146deb9fca..b55af402712933d212257936c8d2bbafe230feb0 100644 ---- a/dist/types/json-rpc.d.ts -+++ b/dist/types/json-rpc.d.ts -@@ -1,14 +1,14 @@ - import { SubjectType } from '@metamask/permission-controller'; - import type { AssertionErrorConstructor, Json, JsonRpcSuccess } from '@metamask/utils'; --import type { Infer } from 'superstruct'; --export declare const RpcOriginsStruct: import("superstruct").Struct<{ -+import type { Infer } from '@metamask/superstruct'; -+export declare const RpcOriginsStruct: import("@metamask/superstruct").Struct<{ - snaps?: boolean | undefined; - dapps?: boolean | undefined; - allowedOrigins?: string[] | undefined; - }, { -- dapps: import("superstruct").Struct; -- snaps: import("superstruct").Struct; -- allowedOrigins: import("superstruct").Struct>; -+ dapps: import("@metamask/superstruct").Struct; -+ snaps: import("@metamask/superstruct").Struct; -+ allowedOrigins: import("@metamask/superstruct").Struct>; - }>; - export declare type RpcOrigins = Infer; - /** -@@ -20,10 +20,10 @@ export declare type RpcOrigins = Infer; - * @throws If the value is not a valid {@link RpcOrigins} object. - */ - export declare function assertIsRpcOrigins(value: unknown, ErrorWrapper?: AssertionErrorConstructor): asserts value is RpcOrigins; --export declare const KeyringOriginsStruct: import("superstruct").Struct<{ -+export declare const KeyringOriginsStruct: import("@metamask/superstruct").Struct<{ - allowedOrigins?: string[] | undefined; - }, { -- allowedOrigins: import("superstruct").Struct>; -+ allowedOrigins: import("@metamask/superstruct").Struct>; - }>; - export declare type KeyringOrigins = Infer; - /** -diff --git a/dist/types/localization.d.ts b/dist/types/localization.d.ts -index c7912195703b45df5901b048022d9ba4bdb6602e..629c378bfb330ce3ae2a9161e871eb30dc55a653 100644 ---- a/dist/types/localization.d.ts -+++ b/dist/types/localization.d.ts -@@ -1,16 +1,16 @@ --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import type { SnapManifest } from './manifest'; - import type { VirtualFile } from './virtual-file'; - export declare const LOCALIZABLE_FIELDS: readonly ["description", "proposedName"]; --export declare const LocalizationFileStruct: import("superstruct").Struct<{ -+export declare const LocalizationFileStruct: import("@metamask/superstruct").Struct<{ - locale: string; - messages: Record; - }, { -- locale: import("superstruct").Struct; -- messages: import("superstruct").Struct; -+ messages: import("@metamask/superstruct").Struct, null>; -diff --git a/dist/types/manifest/validation.d.ts b/dist/types/manifest/validation.d.ts -index b76e0771aaf0c63be437bb65c3f9df6ea88c3c90..aed799be05f1dc2cb3a55ef2118b5dbdd80a881b 100644 ---- a/dist/types/manifest/validation.d.ts -+++ b/dist/types/manifest/validation.d.ts -@@ -1,6 +1,6 @@ - import type { SupportedCurve } from '@metamask/key-tree'; - import type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk'; --import type { Describe, Infer, Struct } from 'superstruct'; -+import type { Describe, Infer, Struct } from '@metamask/superstruct'; - import { type InferMatching } from '../structs'; - export declare const FORBIDDEN_COIN_TYPES: number[]; - export declare const Bip32PathStruct: Struct>; -diff --git a/dist/types/namespace.d.ts b/dist/types/namespace.d.ts -index acff27ac189ddfcd7d2b1da3351e874b8514545f..028eee911e7614e9e25d8a283d408cba1721576f 100644 ---- a/dist/types/namespace.d.ts -+++ b/dist/types/namespace.d.ts -@@ -1,5 +1,5 @@ - import type { AccountId, ChainId } from '@metamask/snaps-sdk'; --import type { Infer } from 'superstruct'; -+import type { Infer } from '@metamask/superstruct'; - import type { InferMatching } from './structs'; - export declare const CHAIN_ID_REGEX: RegExp; - export declare const ACCOUNT_ID_REGEX: RegExp; -@@ -34,29 +34,29 @@ export declare function parseAccountId(accountId: AccountId): { - * A helper struct for a string with a minimum length of 1 and a maximum length - * of 40. - */ --export declare const LimitedString: import("superstruct").Struct; --export declare const ChainIdStringStruct: import("superstruct").Struct<`${string}:${string}`, null>; -+export declare const LimitedString: import("@metamask/superstruct").Struct; -+export declare const ChainIdStringStruct: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; - /** - * A CAIP-2 chain ID, i.e., a human-readable namespace and reference. - */ --export declare const ChainIdStruct: import("superstruct").Struct<`${string}:${string}`, null>; -+export declare const ChainIdStruct: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; - export declare type Caip2ChainId = InferMatching; --export declare const AccountIdStruct: import("superstruct").Struct; --export declare const AccountIdArrayStruct: import("superstruct").Struct>; --export declare const AccountAddressStruct: import("superstruct").Struct; -+export declare const AccountIdStruct: import("@metamask/superstruct").Struct; -+export declare const AccountIdArrayStruct: import("@metamask/superstruct").Struct>; -+export declare const AccountAddressStruct: import("@metamask/superstruct").Struct; - export declare type AccountAddress = Infer; - /** - * A chain descriptor. - */ --export declare const ChainStruct: import("superstruct").Struct<{ -+export declare const ChainStruct: import("@metamask/superstruct").Struct<{ - name: string; - id: `${string}:${string}`; - }, { -- id: import("superstruct").Struct<`${string}:${string}`, null>; -- name: import("superstruct").Struct; -+ id: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; -+ name: import("@metamask/superstruct").Struct; - }>; - export declare type Chain = Infer; --export declare const NamespaceStruct: import("superstruct").Struct<{ -+export declare const NamespaceStruct: import("@metamask/superstruct").Struct<{ - chains: { - name: string; - id: `${string}:${string}`; -@@ -67,30 +67,30 @@ export declare const NamespaceStruct: import("superstruct").Struct<{ - /** - * A list of supported chains in the namespace. - */ -- chains: import("superstruct").Struct<{ -+ chains: import("@metamask/superstruct").Struct<{ - name: string; - id: `${string}:${string}`; -- }[], import("superstruct").Struct<{ -+ }[], import("@metamask/superstruct").Struct<{ - name: string; - id: `${string}:${string}`; - }, { -- id: import("superstruct").Struct<`${string}:${string}`, null>; -- name: import("superstruct").Struct; -+ id: import("@metamask/superstruct").Struct<`${string}:${string}`, null>; -+ name: import("@metamask/superstruct").Struct; - }>>; - /** - * A list of supported RPC methods on the namespace, that a DApp can call. - */ -- methods: import("superstruct").Struct>; -+ methods: import("@metamask/superstruct").Struct>; - /** - * A list of supported RPC events on the namespace, that a DApp can listen to. - */ -- events: import("superstruct").Struct>; -+ events: import("@metamask/superstruct").Struct>; - }>; - export declare type Namespace = Infer; - /** - * A CAIP-2 namespace, i.e., the first part of a chain ID. - */ --export declare const NamespaceIdStruct: import("superstruct").Struct; -+export declare const NamespaceIdStruct: import("@metamask/superstruct").Struct; - export declare type NamespaceId = Infer; - /** - * Check if the given value is a CAIP-2 namespace ID. -diff --git a/dist/types/snaps.d.ts b/dist/types/snaps.d.ts -index 3a71172cf0237fdec276a638432f5ecb1ce5fa31..1952369cfbacf55ed2f34589db63789bd9f29cce 100644 ---- a/dist/types/snaps.d.ts -+++ b/dist/types/snaps.d.ts -@@ -1,7 +1,7 @@ - import type { SubjectPermissions, PermissionConstraint } from '@metamask/permission-controller'; - import type { BlockReason } from '@metamask/snaps-registry'; - import type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk'; --import type { Struct } from 'superstruct'; -+import type { Struct } from '@metamask/superstruct'; - import type { LocalizationFile } from './localization'; - import type { InitialConnections, SnapManifest, SnapPermissions } from './manifest/validation'; - import type { FetchedSnapFiles, SnapsPermissionRequest } from './types'; -diff --git a/dist/types/structs.d.ts b/dist/types/structs.d.ts -index 5b422c937aa9255ddb1f6c4318c397ac9c5b502d..af17efed045764133a569d5c119e2bfb4eb05bbe 100644 ---- a/dist/types/structs.d.ts -+++ b/dist/types/structs.d.ts -@@ -1,6 +1,6 @@ --import type { Failure } from 'superstruct'; --import { Struct, StructError } from 'superstruct'; --import type { AnyStruct, Assign, ObjectSchema, ObjectType } from 'superstruct/dist/utils'; -+import type { Failure } from '@metamask/superstruct'; -+import { Struct, StructError } from '@metamask/superstruct'; -+import type { AnyStruct, Assign, ObjectSchema, ObjectType } from '@metamask/superstruct'; - /** - * Infer a struct type, only if it matches the specified type. This is useful - * for defining types and structs that are related to each other in separate -diff --git a/dist/types/types.d.ts b/dist/types/types.d.ts -index 352b24b26e23625aa1590b282ce0968c7b8ee4c4..cb077cc2b076462353efaafc0fe27523a45fe994 100644 ---- a/dist/types/types.d.ts -+++ b/dist/types/types.d.ts -@@ -1,5 +1,5 @@ - import type { Json } from '@metamask/utils'; --import type { Infer, Struct } from 'superstruct'; -+import type { Infer, Struct } from '@metamask/superstruct'; - import type { SnapCaveatType } from './caveats'; - import type { SnapFunctionExports, SnapRpcHookArgs } from './handlers'; - import type { LocalizationFile } from './localization'; -diff --git a/package.json b/package.json -index 0c83f7a3ab9a033d1aa188629ba722da9a224278..32a782b54a76d9237892bbadbc71da2910fda36c 100644 ---- a/package.json -+++ b/package.json -@@ -49,6 +49,9 @@ - "lint:dependencies": "depcheck", - "build:ci": "tsup --clean" - }, -+ "resolutions": { -+ "@metamask/superstruct": "3.1.0" -+ }, - "dependencies": { - "@babel/core": "^7.23.2", - "@babel/types": "^7.23.0", -@@ -59,7 +62,8 @@ - "@metamask/slip44": "^3.1.0", - "@metamask/snaps-registry": "^3.1.0", - "@metamask/snaps-sdk": "^6.0.0", -- "@metamask/utils": "^8.3.0", -+ "@metamask/superstruct": "^3.1.0", -+ "@metamask/utils": "^9.0.0", - "@noble/hashes": "^1.3.1", - "@scure/base": "^1.1.1", - "chalk": "^4.1.2", -@@ -71,7 +75,6 @@ - "rfdc": "^1.3.0", - "semver": "^7.5.4", - "ses": "^1.1.0", -- "superstruct": "^1.0.3", - "validate-npm-package-name": "^5.0.0" - }, - "devDependencies": { From 9226a38f67dd371b137bc2e7ad0980eb5b33aad8 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 23:09:05 -0400 Subject: [PATCH 37/47] Remove unused entry from .depcheckrc.yml --- .depcheckrc.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.depcheckrc.yml b/.depcheckrc.yml index a7fae7d54b..c7b8238193 100644 --- a/.depcheckrc.yml +++ b/.depcheckrc.yml @@ -16,7 +16,6 @@ ignores: - 'simple-git-hooks' - 'ts-node' - 'typedoc' - - 'which' # Ignore plugins implicitly imported by tools - 'jest-silent-reporter' - 'prettier-plugin-packagejson' From 555ec316956fcedd62d9c54ef00c1065f207bad7 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 23:15:35 -0400 Subject: [PATCH 38/47] Update jest.config.scripts.js --- jest.config.scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.scripts.js b/jest.config.scripts.js index a143e614b9..343c51b9d2 100644 --- a/jest.config.scripts.js +++ b/jest.config.scripts.js @@ -39,7 +39,7 @@ module.exports = { }, // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module - // This ensures that Babel can resolve ESM exports correctly. + // This ensures that Babel can resolve subpath exports correctly. moduleNameMapper: { '^@metamask/utils/(.+)$': [ '/node_modules/@metamask/utils/dist/$1.cjs', From 6defd768f2916be2ea27c206f9e9fdb71b58b4b7 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Sun, 7 Jul 2024 16:48:30 -0400 Subject: [PATCH 39/47] build(tsc): Set `moduleResolution` to `node16` --- tsconfig.packages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.packages.json b/tsconfig.packages.json index 875bc0339d..8d0d5aee5e 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -3,8 +3,8 @@ "composite": true, "esModuleInterop": true, "lib": ["ES2020", "DOM"], - "module": "NodeNext", - "moduleResolution": "NodeNext", + "module": "Node16", + "moduleResolution": "Node16", /** * Here we ensure that TypeScript resolves `@metamask/*` imports to the * uncompiled source code for packages that live in this repo. From 0910cea97e83a7d7fdeaa7c042c81d247c0ecc8f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 8 Jul 2024 13:33:05 -0400 Subject: [PATCH 40/47] Dedupe lockfile --- yarn.lock | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/yarn.lock b/yarn.lock index c1b91ab0f0..516e71e0af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5093,7 +5093,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.11.0": +"acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": version: 8.12.0 resolution: "acorn@npm:8.12.0" bin: @@ -5102,15 +5102,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10/b688e7e3c64d9bfb17b596e1b35e4da9d50553713b3b3630cf5690f2b023a84eac90c56851e6912b483fe60e8b4ea28b254c07e92f17ef83d72d78745a8352dd - languageName: node - linkType: hard - "aes-js@npm:4.0.0-beta.5": version: 4.0.0-beta.5 resolution: "aes-js@npm:4.0.0-beta.5" From b0fd3b8fab9ca32b5b2c3ff47b0469eddcb93c67 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 11 Jul 2024 17:36:58 -0400 Subject: [PATCH 41/47] Remove unused `ts-expect-error` directive --- packages/accounts-controller/src/AccountsController.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index 8882d23ad5..dde5f31a11 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -423,7 +423,6 @@ export class AccountsController extends BaseController< ...account, metadata: { ...account.metadata, name: accountName }, }; - // @ts-expect-error ts(2589) currentState.internalAccounts.accounts[accountId] = internalAccount; }); } From b8f8c52378f579cb91a854f4386de5ccca477544 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Sat, 13 Jul 2024 23:36:44 -0400 Subject: [PATCH 42/47] Update yarn resolution for snaps monorepo and fix `@metamask/providers` to `17.0.0` --- package.json | 5 +-- yarn.lock | 90 ++++++++++++++++++++-------------------------------- 2 files changed, 38 insertions(+), 57 deletions(-) diff --git a/package.json b/package.json index 69bd2660fc..583f06442e 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,9 @@ }, "resolutions": { "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", - "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732", - "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732", + "@metamask/providers": "17.0.0", + "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", + "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index dffb84eaca..a11072974f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2398,7 +2398,7 @@ __metadata: languageName: node linkType: hard -"@metamask/base-controller@npm:^6.0.0, @metamask/base-controller@npm:^6.0.1, @metamask/base-controller@workspace:packages/base-controller": +"@metamask/base-controller@npm:^6.0.1, @metamask/base-controller@workspace:packages/base-controller": version: 0.0.0-use.local resolution: "@metamask/base-controller@workspace:packages/base-controller" dependencies: @@ -3045,7 +3045,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^9.0.0, @metamask/json-rpc-engine@npm:^9.0.1, @metamask/json-rpc-engine@workspace:packages/json-rpc-engine": +"@metamask/json-rpc-engine@npm:^9.0.1, @metamask/json-rpc-engine@workspace:packages/json-rpc-engine": version: 0.0.0-use.local resolution: "@metamask/json-rpc-engine@workspace:packages/json-rpc-engine" dependencies: @@ -3076,7 +3076,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@npm:^8.0.0, @metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": +"@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": version: 0.0.0-use.local resolution: "@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream" dependencies: @@ -3099,16 +3099,16 @@ __metadata: languageName: unknown linkType: soft -"@metamask/key-tree@npm:^9.1.1": - version: 9.1.1 - resolution: "@metamask/key-tree@npm:9.1.1" +"@metamask/key-tree@npm:^9.1.1, @metamask/key-tree@npm:^9.1.2": + version: 9.1.2 + resolution: "@metamask/key-tree@npm:9.1.2" dependencies: "@metamask/scure-bip39": "npm:^2.1.1" - "@metamask/utils": "npm:^8.3.0" + "@metamask/utils": "npm:^9.0.0" "@noble/curves": "npm:^1.2.0" "@noble/hashes": "npm:^1.3.2" "@scure/base": "npm:^1.0.0" - checksum: 10/3673cdef00536a1237efc73872b1ee49cb6b4ccc6ab5096c4bc4b5e885b68ad58074b10a25fa2b6e2ac8e1dc3006fbe3ff0c2b9f3e0a8c1526b9dbf28f4bfd88 + checksum: 10/9b178a4156b2f36bf630564dd0530c41c6356492971d2bcc8f979c79c81144945823a5b770e4097e12b89b42133b81f00c95a7b8fe9931ea1dd928989ee3c406 languageName: node linkType: hard @@ -3116,7 +3116,7 @@ __metadata: version: 8.0.0 resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=6ec0879a3d7bf467c850e7dd17728aa9119aa68c" dependencies: - "@metamask/providers": "npm:^17.1.0" + "@metamask/providers": "npm:17.0.0" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^9.0.0" @@ -3549,24 +3549,24 @@ __metadata: languageName: unknown linkType: soft -"@metamask/providers@npm:^17.0.0, @metamask/providers@npm:^17.1.0": - version: 17.1.0 - resolution: "@metamask/providers@npm:17.1.0" +"@metamask/providers@npm:17.0.0": + version: 17.0.0 + resolution: "@metamask/providers@npm:17.0.0" dependencies: - "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/json-rpc-middleware-stream": "npm:^8.0.0" + "@metamask/json-rpc-engine": "npm:^8.0.1" + "@metamask/json-rpc-middleware-stream": "npm:^7.0.1" "@metamask/object-multiplex": "npm:^2.0.0" "@metamask/rpc-errors": "npm:^6.2.1" "@metamask/safe-event-emitter": "npm:^3.1.1" "@metamask/utils": "npm:^8.3.0" detect-browser: "npm:^5.2.0" - extension-port-stream: "npm:^4.1.0" + extension-port-stream: "npm:^3.0.0" fast-deep-equal: "npm:^3.1.3" is-stream: "npm:^2.0.0" readable-stream: "npm:^3.6.2" peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/12c24b1c81aff0e60ec69eb878e069a8ea3a61025213e825c074117f2f4dd7779ac1a0be23ab7016d24c5ad1be0bbebf1e4f4f082551bb63d17a0be7e19235e3 + checksum: 10/9e6b84120276035c9d7e776da4f7e18243116c53fd0c33efca17034971981164720e808dff055e871d08b9ed9d78dc9ebd0d974238baa599d7d91e1560fc1abb languageName: node linkType: hard @@ -3745,15 +3745,15 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.1.0, @metamask/snaps-registry@npm:^3.2.0": - version: 3.2.0 - resolution: "@metamask/snaps-registry@npm:3.2.0" +"@metamask/snaps-registry@npm:^3.1.0, @metamask/snaps-registry@npm:^3.2.1": + version: 3.2.1 + resolution: "@metamask/snaps-registry@npm:3.2.1" dependencies: - "@metamask/superstruct": "npm:^3.0.0" - "@metamask/utils": "npm:^8.5.0" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.0.0" "@noble/curves": "npm:^1.2.0" "@noble/hashes": "npm:^1.3.2" - checksum: 10/be187ea4f95f57fe8367175e3dbc250f0dadc5f693b83005a91f296ebf3b3284bfa30cf489f3e26139d0a965bfb8fe9c6996e02c750ab9a2df64a456470adbfb + checksum: 10/b2a413f27db9b5701d3773017035ee1e153734a25363e3877f44be4a70f51c48d77ad0ac8f1e96a7d732d2079a4b259896f361b3cba1ae0bf0bbc1075406f178 languageName: node linkType: hard @@ -3773,31 +3773,31 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732": +"@metamask/snaps-sdk@github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6": version: 6.0.0 - resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-sdk&commit=befb79405932d86ff6c40f61cb4b767a8224e732" + resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6" dependencies: - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/providers": "npm:^17.0.0" + "@metamask/key-tree": "npm:^9.1.2" + "@metamask/providers": "npm:17.0.0" "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^9.0.0" - checksum: 10/9e6e768e1ff1906170e517dbf59006601c54fcb1c9fe1be6b81af8b25b2807292fc201affcf40003684332dd0e904529ae5b8d7646ebb7fe3fc981e2e7862ac1 + checksum: 10/aba1cec053caf1a460bf143fa340f4722f97dbcf325bef7e0203cd0823b4411ab2da0bf945d54293a89cd3847d40057f2a524324e8d15897cfaf59b7b6acbe12 languageName: node linkType: hard -"@metamask/snaps-utils@github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732": +"@metamask/snaps-utils@github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6": version: 7.7.0 - resolution: "@metamask/snaps-utils@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-utils&commit=befb79405932d86ff6c40f61cb4b767a8224e732" + resolution: "@metamask/snaps-utils@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@metamask/base-controller": "npm:^6.0.0" - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/permission-controller": "npm:^10.0.0" + "@metamask/base-controller": "npm:^6.0.1" + "@metamask/key-tree": "npm:^9.1.2" + "@metamask/permission-controller": "npm:^10.0.1" "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/slip44": "npm:^3.1.0" - "@metamask/snaps-registry": "npm:^3.2.0" + "@metamask/snaps-registry": "npm:^3.2.1" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^9.0.0" @@ -3813,7 +3813,7 @@ __metadata: semver: "npm:^7.5.4" ses: "npm:^1.1.0" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/254c7899c36c6460ca2dc0f79d85dac52dbf5fad435d10a941cf147bf69feafc9732d0804d0cda517eb9839389aa4f4c8d47a4a3e929506e8f53564d826be5c3 + checksum: 10/27e70d9c0450ae93ef6268fc26d62054bbd1c61b05d1237c5e888177956652aabca290f49ec7de34421dd311d6ed41691cdf9b611b6d28cbc17dffa672f89307 languageName: node linkType: hard @@ -5093,7 +5093,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.11.0": +"acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": version: 8.12.0 resolution: "acorn@npm:8.12.0" bin: @@ -5102,15 +5102,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10/b688e7e3c64d9bfb17b596e1b35e4da9d50553713b3b3630cf5690f2b023a84eac90c56851e6912b483fe60e8b4ea28b254c07e92f17ef83d72d78745a8352dd - languageName: node - linkType: hard - "aes-js@npm:4.0.0-beta.5": version: 4.0.0-beta.5 resolution: "aes-js@npm:4.0.0-beta.5" @@ -7643,17 +7634,6 @@ __metadata: languageName: node linkType: hard -"extension-port-stream@npm:^4.1.0": - version: 4.1.0 - resolution: "extension-port-stream@npm:4.1.0" - dependencies: - readable-stream: "npm:^3.6.2 || ^4.4.2" - peerDependencies: - webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/e349277cf65a89c2a6c4f3611f52e0a97497bd2870a4c25aa4ab11b300c48e3013fd95208e3ff6c8494dfb849eed725e7506e59118b1a69e555fa4b67afdbd83 - languageName: node - linkType: hard - "fast-copy@npm:^2.1.7": version: 2.1.7 resolution: "fast-copy@npm:2.1.7" From f2f7d1fe90183e14430c247933a07f03bcd52491 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Sun, 14 Jul 2024 00:16:23 -0400 Subject: [PATCH 43/47] Remove yarn resolution for `@metamask/providers` `17.0.0` --- package.json | 1 - yarn.lock | 1081 +++++++++++++++++++++++++------------------------- 2 files changed, 544 insertions(+), 538 deletions(-) diff --git a/package.json b/package.json index a07359bfc5..582586a18d 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ }, "resolutions": { "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", - "@metamask/providers": "17.0.0", "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" diff --git a/yarn.lock b/yarn.lock index 86e3f7e96c..2c6404ba26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -41,45 +41,45 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/compat-data@npm:7.24.7" - checksum: 10/6edc09152ca51a22c33741c441f33f9475598fa59edc53369edb74b49f4ea4bef1281f5b0ed2b9b67fb66faef2da2069e21c4eef83405d8326e524b301f4e7e2 +"@babel/compat-data@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/compat-data@npm:7.24.8" + checksum: 10/6989b8a61782d9c6c7a1fc58b4efd4fb68e5f5a5b6be3463a3de3752f39a30d21438b8b4485c18cb6b8d7f29e07f79d79639caa08737fae57838e81d7da055c0 languageName: node linkType: hard "@babel/core@npm:^7.1.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.23.2, @babel/core@npm:^7.23.5, @babel/core@npm:^7.7.2, @babel/core@npm:^7.8.0": - version: 7.24.7 - resolution: "@babel/core@npm:7.24.7" + version: 7.24.8 + resolution: "@babel/core@npm:7.24.8" dependencies: "@ampproject/remapping": "npm:^2.2.0" "@babel/code-frame": "npm:^7.24.7" - "@babel/generator": "npm:^7.24.7" - "@babel/helper-compilation-targets": "npm:^7.24.7" - "@babel/helper-module-transforms": "npm:^7.24.7" - "@babel/helpers": "npm:^7.24.7" - "@babel/parser": "npm:^7.24.7" + "@babel/generator": "npm:^7.24.8" + "@babel/helper-compilation-targets": "npm:^7.24.8" + "@babel/helper-module-transforms": "npm:^7.24.8" + "@babel/helpers": "npm:^7.24.8" + "@babel/parser": "npm:^7.24.8" "@babel/template": "npm:^7.24.7" - "@babel/traverse": "npm:^7.24.7" - "@babel/types": "npm:^7.24.7" + "@babel/traverse": "npm:^7.24.8" + "@babel/types": "npm:^7.24.8" convert-source-map: "npm:^2.0.0" debug: "npm:^4.1.0" gensync: "npm:^1.0.0-beta.2" json5: "npm:^2.2.3" semver: "npm:^6.3.1" - checksum: 10/ef8cc1afa3ccecee6d1f5660c487ccc2a3f25106830ea9040e80ef4b2092e053607ee4ddd03493e4f7ef2f9967a956ca53b830d54c5bee738eeb58cce679dd4a + checksum: 10/79818e6e8ecd5f50ffbfb8dfb1748928e6e17b198bd8da0d6f725bf67aece5141020cd3aba56dc425a33e118c0e80e5569ad6fa615897e49726087dd875279d7 languageName: node linkType: hard -"@babel/generator@npm:^7.24.7, @babel/generator@npm:^7.7.2": - version: 7.24.7 - resolution: "@babel/generator@npm:7.24.7" +"@babel/generator@npm:^7.24.8, @babel/generator@npm:^7.7.2": + version: 7.24.8 + resolution: "@babel/generator@npm:7.24.8" dependencies: - "@babel/types": "npm:^7.24.7" + "@babel/types": "npm:^7.24.8" "@jridgewell/gen-mapping": "npm:^0.3.5" "@jridgewell/trace-mapping": "npm:^0.3.25" jsesc: "npm:^2.5.1" - checksum: 10/c71d24a4b41b19c10d2f2eb819f27d4cf94220e2322f7c8fed8bfbbb115b2bebbdd6dc1f27dac78a175e90604def58d763af87e0fa81ce4ab1582858162cf768 + checksum: 10/dc1bd931120f93e7a5b35fdf66c13ca56b966b07ee9ba124f7e24b1905cbcf7d7891cc7c281961876eff9fcff67c46652cce89847665e263bc04d283d4343164 languageName: node linkType: hard @@ -92,27 +92,27 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-compilation-targets@npm:7.24.7" +"@babel/helper-compilation-targets@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-compilation-targets@npm:7.24.8" dependencies: - "@babel/compat-data": "npm:^7.24.7" - "@babel/helper-validator-option": "npm:^7.24.7" - browserslist: "npm:^4.22.2" + "@babel/compat-data": "npm:^7.24.8" + "@babel/helper-validator-option": "npm:^7.24.8" + browserslist: "npm:^4.23.1" lru-cache: "npm:^5.1.1" semver: "npm:^6.3.1" - checksum: 10/8f8bc89af70a606ccb208513aa25d83e19b88f91b64a33174f7701a9479e67ddbb0a9c89033265070375cd24e690b93380b3a3ea11e4b3a711d742f0f4699ee7 + checksum: 10/3489280d07b871af565b32f9b11946ff9a999fac0db9bec5df960760f6836c7a4b52fccb9d64229ccce835d37a43afb85659beb439ecedde04dcea7eb062a143 languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-create-class-features-plugin@npm:7.24.7" +"@babel/helper-create-class-features-plugin@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-create-class-features-plugin@npm:7.24.8" dependencies: "@babel/helper-annotate-as-pure": "npm:^7.24.7" "@babel/helper-environment-visitor": "npm:^7.24.7" "@babel/helper-function-name": "npm:^7.24.7" - "@babel/helper-member-expression-to-functions": "npm:^7.24.7" + "@babel/helper-member-expression-to-functions": "npm:^7.24.8" "@babel/helper-optimise-call-expression": "npm:^7.24.7" "@babel/helper-replace-supers": "npm:^7.24.7" "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.24.7" @@ -120,7 +120,7 @@ __metadata: semver: "npm:^6.3.1" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10/8ecb1c2acc808e1e0c21dccc7ea6899de9a140cb1856946800176b4784de6fccd575661fbff7744bb895d01aa6956ce963446b8577c4c2334293ba5579d5cdb9 + checksum: 10/a779c5356fcc4881e807d85d973fd37e99e773fe95837b0f6582ca9a89331f84e5f26b0b6aa9a101181325b73cf3f54081d178b657a79819b8abadc53b0ea8ec languageName: node linkType: hard @@ -152,13 +152,13 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-member-expression-to-functions@npm:7.24.7" +"@babel/helper-member-expression-to-functions@npm:^7.24.7, @babel/helper-member-expression-to-functions@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-member-expression-to-functions@npm:7.24.8" dependencies: - "@babel/traverse": "npm:^7.24.7" - "@babel/types": "npm:^7.24.7" - checksum: 10/d990752aaff311aba0ca61539e1776c5ba2818836403f9bafac849deb4cd24c082cbde5f23e490b7f3614c95ff67f8d75fa5e2f14cb00586a72c96c158e1127b + "@babel/traverse": "npm:^7.24.8" + "@babel/types": "npm:^7.24.8" + checksum: 10/ac878761cfd0a46c081cda0da75cc186f922cf16e8ecdd0c4fb6dca4330d9fe4871b41a9976224cf9669c9e7fe0421b5c27349f2e99c125fa0be871b327fa770 languageName: node linkType: hard @@ -172,9 +172,9 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-module-transforms@npm:7.24.7" +"@babel/helper-module-transforms@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-module-transforms@npm:7.24.8" dependencies: "@babel/helper-environment-visitor": "npm:^7.24.7" "@babel/helper-module-imports": "npm:^7.24.7" @@ -183,7 +183,7 @@ __metadata: "@babel/helper-validator-identifier": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10/4f2b232bf6d1be8d3a72b084a2a7ac1b0b93ea85717411a11ae1fb6375d4392019e781d8cc155789e649a2caa7eec378dd1404210603d6d4230f042c5feacffb + checksum: 10/912ad994da126c3150d8f8702030380849608094a7a352523ffa8e697080da9358d63af2582d38902c929839f394bbc6f1ae4921ba132ba3f65f27f0696aa2c7 languageName: node linkType: hard @@ -196,10 +196,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.24.7, @babel/helper-plugin-utils@npm:^7.8.0": - version: 7.24.7 - resolution: "@babel/helper-plugin-utils@npm:7.24.7" - checksum: 10/dad51622f0123fdba4e2d40a81a6b7d6ef4b1491b2f92fd9749447a36bde809106cf117358705057a2adc8fd73d5dc090222e0561b1213dae8601c8367f5aac8 +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.24.7, @babel/helper-plugin-utils@npm:^7.24.8, @babel/helper-plugin-utils@npm:^7.8.0": + version: 7.24.8 + resolution: "@babel/helper-plugin-utils@npm:7.24.8" + checksum: 10/adbc9fc1142800a35a5eb0793296924ee8057fe35c61657774208670468a9fbfbb216f2d0bc46c680c5fefa785e5ff917cc1674b10bd75cdf9a6aa3444780630 languageName: node linkType: hard @@ -245,10 +245,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-string-parser@npm:7.24.7" - checksum: 10/603d8d962bbe89907aa99a8f19a006759ab7b2464615f20a6a22e3e2e8375af37ddd0e5175c9e622e1c4b2d83607ffb41055a59d0ce34404502af30fde573a5c +"@babel/helper-string-parser@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-string-parser@npm:7.24.8" + checksum: 10/6d1bf8f27dd725ce02bdc6dffca3c95fb9ab8a06adc2edbd9c1c9d68500274230d1a609025833ed81981eff560045b6b38f7b4c6fb1ab19fc90e5004e3932535 languageName: node linkType: hard @@ -259,20 +259,20 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-option@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-validator-option@npm:7.24.7" - checksum: 10/9689166bf3f777dd424c026841c8cd651e41b21242dbfd4569a53086179a3e744c8eddd56e9d10b54142270141c91581b53af0d7c00c82d552d2540e2a919f7e +"@babel/helper-validator-option@npm:^7.24.7, @babel/helper-validator-option@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helper-validator-option@npm:7.24.8" + checksum: 10/a52442dfa74be6719c0608fee3225bd0493c4057459f3014681ea1a4643cd38b68ff477fe867c4b356da7330d085f247f0724d300582fa4ab9a02efaf34d107c languageName: node linkType: hard -"@babel/helpers@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helpers@npm:7.24.7" +"@babel/helpers@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/helpers@npm:7.24.8" dependencies: "@babel/template": "npm:^7.24.7" - "@babel/types": "npm:^7.24.7" - checksum: 10/f7496f0d7a0b13ea86136ac2053371027125734170328215f8a90eac96fafaaae4e5398c0729bdadf23261c00582a31e14bc70113427653b718220641a917f9d + "@babel/types": "npm:^7.24.8" + checksum: 10/61c08a2baa87382a87c7110e9b5574c782603e247b7e6267769ee0e8b7b54b70ff05f16466f05bb318622b7ac28e79b449edff565abf5adcb1adb1b0f42fee9c languageName: node linkType: hard @@ -288,12 +288,12 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/parser@npm:7.24.7" +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.24.7, @babel/parser@npm:^7.24.8": + version: 7.24.8 + resolution: "@babel/parser@npm:7.24.8" bin: parser: ./bin/babel-parser.js - checksum: 10/ef9ebce60e13db560ccc7af9235d460f6726bb7e23ae2d675098c1fc43d5249067be60d4118889dad33b1d4f85162cf66baf554719e1669f29bb20e71322568e + checksum: 10/e44b8327da46e8659bc9fb77f66e2dc4364dd66495fb17d046b96a77bf604f0446f1e9a89cf2f011d78fc3f5cdfbae2e9e0714708e1c985988335683b2e781ef languageName: node linkType: hard @@ -452,29 +452,29 @@ __metadata: linkType: hard "@babel/plugin-transform-modules-commonjs@npm:^7.23.3, @babel/plugin-transform-modules-commonjs@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.7" + version: 7.24.8 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.8" dependencies: - "@babel/helper-module-transforms": "npm:^7.24.7" - "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-module-transforms": "npm:^7.24.8" + "@babel/helper-plugin-utils": "npm:^7.24.8" "@babel/helper-simple-access": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/9bd10cd03cce138a644f4e671025058348d8ff364253122bed60f9a2a32759445b93e8a6501773491cb19906602b18fd26255df0caac425343a1584599b36b24 + checksum: 10/18e5d229767c7b5b6ff0cbf1a8d2d555965b90201839d0ac2dc043b56857624ea344e59f733f028142a8c1d54923b82e2a0185694ef36f988d797bfbaf59819c languageName: node linkType: hard "@babel/plugin-transform-typescript@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/plugin-transform-typescript@npm:7.24.7" + version: 7.24.8 + resolution: "@babel/plugin-transform-typescript@npm:7.24.8" dependencies: "@babel/helper-annotate-as-pure": "npm:^7.24.7" - "@babel/helper-create-class-features-plugin": "npm:^7.24.7" - "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-create-class-features-plugin": "npm:^7.24.8" + "@babel/helper-plugin-utils": "npm:^7.24.8" "@babel/plugin-syntax-typescript": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/6a4af5a96a90f08ea679829abc558b8478b8b31b40c84b887f2859110b75ab2c8c48a2cf80193621d988a6b064aefef2a74ea3ccc310166219f87959d06a3033 + checksum: 10/a41b687dcb86c28888ef022f4c0136a75ad66ae26787da06ff9c3232ddf7e2bd36a570b89e9c40924cf95880152eb4123c31bc19118f20d441f68256595d8677 languageName: node linkType: hard @@ -494,11 +494,11 @@ __metadata: linkType: hard "@babel/runtime@npm:^7.23.9": - version: 7.24.7 - resolution: "@babel/runtime@npm:7.24.7" + version: 7.24.8 + resolution: "@babel/runtime@npm:7.24.8" dependencies: regenerator-runtime: "npm:^0.14.0" - checksum: 10/7b77f566165dee62db3db0296e71d08cafda3f34e1b0dcefcd68427272e17c1704f4e4369bff76651b07b6e49d3ea5a0ce344818af9116e9292e4381e0918c76 + checksum: 10/e6f335e472a8a337379effc15815dd0eddf6a7d0c00b50deb4f9e9585819b45431d0ff3c2d3d0fa58c227a9b04dcc4a85e7245fb57493adb2863b5208c769cbd languageName: node linkType: hard @@ -513,32 +513,32 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.24.7, @babel/traverse@npm:^7.7.2": - version: 7.24.7 - resolution: "@babel/traverse@npm:7.24.7" +"@babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.24.7, @babel/traverse@npm:^7.24.8, @babel/traverse@npm:^7.7.2": + version: 7.24.8 + resolution: "@babel/traverse@npm:7.24.8" dependencies: "@babel/code-frame": "npm:^7.24.7" - "@babel/generator": "npm:^7.24.7" + "@babel/generator": "npm:^7.24.8" "@babel/helper-environment-visitor": "npm:^7.24.7" "@babel/helper-function-name": "npm:^7.24.7" "@babel/helper-hoist-variables": "npm:^7.24.7" "@babel/helper-split-export-declaration": "npm:^7.24.7" - "@babel/parser": "npm:^7.24.7" - "@babel/types": "npm:^7.24.7" + "@babel/parser": "npm:^7.24.8" + "@babel/types": "npm:^7.24.8" debug: "npm:^4.3.1" globals: "npm:^11.1.0" - checksum: 10/785cf26383a992740e492efba7016de964cd06c05c9d7146fa1b5ead409e054c444f50b36dc37856884a56e32cf9d3105ddf1543486b6df68300bffb117a245a + checksum: 10/47d8ecf8cfff58fe621fc4d8454b82c97c407816d8f9c435caa0c849ea7c357b91119a06f3c69f21a0228b5d06ac0b44f49d1f78cff032d6266317707f1fe615 languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.23.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.3.3, @babel/types@npm:^7.8.3": - version: 7.24.7 - resolution: "@babel/types@npm:7.24.7" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.23.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.3.3, @babel/types@npm:^7.8.3": + version: 7.24.8 + resolution: "@babel/types@npm:7.24.8" dependencies: - "@babel/helper-string-parser": "npm:^7.24.7" + "@babel/helper-string-parser": "npm:^7.24.8" "@babel/helper-validator-identifier": "npm:^7.24.7" to-fast-properties: "npm:^2.0.0" - checksum: 10/ad3c8c0d6fb4acb0bb74bb5b4bb849b181bf6185677ef9c59c18856c81e43628d0858253cf232f0eca806f02e08eff85a1d3e636a3e94daea737597796b0b430 + checksum: 10/29b080b2753c22ee5e2455ff767a971443245d945dea4d1b3130e036dcdf0949a89539a581753c68d03d2f2f2325244ee0f91fb83dabee1cbac5db5246838137 languageName: node linkType: hard @@ -776,9 +776,9 @@ __metadata: linkType: hard "@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": - version: 4.10.1 - resolution: "@eslint-community/regexpp@npm:4.10.1" - checksum: 10/54f13817caf90545502d7a19e1b61df79087aee9584342ffc558b6d067530764a47f1c484f493f43e2c70cfdff59ccfd5f26df2af298c4ad528469e599bd1d53 + version: 4.11.0 + resolution: "@eslint-community/regexpp@npm:4.11.0" + checksum: 10/f053f371c281ba173fe6ee16dbc4fe544c84870d58035ccca08dba7f6ce1830d895ce3237a0db89ba37616524775dca82f1c502066b58e2d5712d7f87f5ba17c languageName: node linkType: hard @@ -1145,18 +1145,18 @@ __metadata: languageName: node linkType: hard -"@firebase/analytics-compat@npm:0.2.10": - version: 0.2.10 - resolution: "@firebase/analytics-compat@npm:0.2.10" +"@firebase/analytics-compat@npm:0.2.11": + version: 0.2.11 + resolution: "@firebase/analytics-compat@npm:0.2.11" dependencies: - "@firebase/analytics": "npm:0.10.4" + "@firebase/analytics": "npm:0.10.5" "@firebase/analytics-types": "npm:0.8.2" - "@firebase/component": "npm:0.6.7" - "@firebase/util": "npm:1.9.6" + "@firebase/component": "npm:0.6.8" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/6dd463dab0279d22d8413accee1a1326e4f1937440b96fb25ae96490ee6ad6c5b32836ac1202f0baaf63d3bdb634e2470a970e7a37e9020b22d6323d4a59b134 + checksum: 10/843b9cef7d724ce72c63d9e8eca267abb3a7286d0c6a8de32cd3b66fcb8563fe8ae60bed7c07761aad7ef37fca425e2c2f7535691177ea7d8c184b6037f0b564 languageName: node linkType: hard @@ -1167,34 +1167,34 @@ __metadata: languageName: node linkType: hard -"@firebase/analytics@npm:0.10.4": - version: 0.10.4 - resolution: "@firebase/analytics@npm:0.10.4" +"@firebase/analytics@npm:0.10.5": + version: 0.10.5 + resolution: "@firebase/analytics@npm:0.10.5" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/installations": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" + "@firebase/installations": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10/0b8f75ff08e7547399ae0f7bc68a76f54b55ef02f50b603abb0ffe36d60de2c006ecde8db825aff9a48cbf047b4225f8063afe9051383d28dae6498d76317132 + checksum: 10/fb17b6b5bd2c8b41bc42409a60806fd7504e8c255f9e518a73b3f60dc9b92fdb5a48171a1699980475ca57626bcada1014d34e7829719585813b4a1edea2eb2d languageName: node linkType: hard -"@firebase/app-check-compat@npm:0.3.11": - version: 0.3.11 - resolution: "@firebase/app-check-compat@npm:0.3.11" +"@firebase/app-check-compat@npm:0.3.12": + version: 0.3.12 + resolution: "@firebase/app-check-compat@npm:0.3.12" dependencies: - "@firebase/app-check": "npm:0.8.4" + "@firebase/app-check": "npm:0.8.5" "@firebase/app-check-types": "npm:0.5.2" - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/db8f2342ad4b7b3053d082472fe2b4b38572406228828513189adf13a827c80a65d4ce0b19c5f695baadea452fb695b774c9ae5b639a4b733a002df44cb3bbb1 + checksum: 10/b4bd4282ee7e3c1d269d1d9ddc97d41fd84fc8c7e76c1f74c034297cef9a11d89002a88e46d96472d4cc61a4f37df7d5882a86ff120738b87c9732e01d2a9e64 languageName: node linkType: hard @@ -1212,30 +1212,30 @@ __metadata: languageName: node linkType: hard -"@firebase/app-check@npm:0.8.4": - version: 0.8.4 - resolution: "@firebase/app-check@npm:0.8.4" +"@firebase/app-check@npm:0.8.5": + version: 0.8.5 + resolution: "@firebase/app-check@npm:0.8.5" dependencies: - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10/0f4ea3c930141ae08c98dc67463d7b6c9b67c0a98a10768a6be7ba1ec56181ffcdeb5e26f60f6cb721794bd03d7e6132541148417f8da45473139c8a138a7d94 + checksum: 10/3d66e8802dde4b6d0e064afcb4571c0d1d84661e5bf0e5dfdf9f6b544bcf5fee3930a5b94fcf4ea8be5f117bcfb9fb9905d4fbe7f887faa5e5eb25ca7cf37042 languageName: node linkType: hard -"@firebase/app-compat@npm:0.2.35": - version: 0.2.35 - resolution: "@firebase/app-compat@npm:0.2.35" +"@firebase/app-compat@npm:0.2.36": + version: 0.2.36 + resolution: "@firebase/app-compat@npm:0.2.36" dependencies: - "@firebase/app": "npm:0.10.5" - "@firebase/component": "npm:0.6.7" + "@firebase/app": "npm:0.10.6" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" - checksum: 10/6de5c8666af2941b56e550f4207b151fade057b91c995cccc5a1f66abb809b9b92c30b3932d473903d17c57b0fa454bae432c3855ac5a5c6b2785e387852b4a2 + checksum: 10/340e72056d9b420298db6ac0097e019471ff63e70e1b58b2de862ebf1ec83357f683c3a0c7a0364bc703e1fc24e40767ade0532b8b223dfc9503f865040901ca languageName: node linkType: hard @@ -1246,32 +1246,32 @@ __metadata: languageName: node linkType: hard -"@firebase/app@npm:0.10.5": - version: 0.10.5 - resolution: "@firebase/app@npm:0.10.5" +"@firebase/app@npm:0.10.6": + version: 0.10.6 + resolution: "@firebase/app@npm:0.10.6" dependencies: - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" idb: "npm:7.1.1" tslib: "npm:^2.1.0" - checksum: 10/55c4190e578efd083c8e22a7ba7b078b2c4c4911e08e79d5187b2779121f9552ee35490373d2f8a101285e6c57c4b8ea1b019137b0274eaee72aa10a790fb564 + checksum: 10/ac1d79cd62d7f90a481545b6fc0495c08f5611d54b52314f41cd27c4fe47f578a908073ee97c6f8395b88130cde2b7db0bfdf5d5324e750778c9689e1cd3275e languageName: node linkType: hard -"@firebase/auth-compat@npm:0.5.9": - version: 0.5.9 - resolution: "@firebase/auth-compat@npm:0.5.9" +"@firebase/auth-compat@npm:0.5.10": + version: 0.5.10 + resolution: "@firebase/auth-compat@npm:0.5.10" dependencies: - "@firebase/auth": "npm:1.7.4" + "@firebase/auth": "npm:1.7.5" "@firebase/auth-types": "npm:0.12.2" - "@firebase/component": "npm:0.6.7" - "@firebase/util": "npm:1.9.6" + "@firebase/component": "npm:0.6.8" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" undici: "npm:5.28.4" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/671203fc6e2fe7d4fc4332129848f552839a771f405fff18502f5035b4e9eda76ad067c2e75b1cbe3e2d4d365d899b092a5f0bd1b395c0ac43c1464e213992fe + checksum: 10/16d85eccb138ee53c36b20a99c1462f83124d7eb2d2e49a7c2efb72cdf7d15c3f6dbf7c8fd8519ec6ec224a66c2c347235b1b254f4375fae2bfe1653b1f78551 languageName: node linkType: hard @@ -1292,13 +1292,13 @@ __metadata: languageName: node linkType: hard -"@firebase/auth@npm:1.7.4": - version: 1.7.4 - resolution: "@firebase/auth@npm:1.7.4" +"@firebase/auth@npm:1.7.5": + version: 1.7.5 + resolution: "@firebase/auth@npm:1.7.5" dependencies: - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" undici: "npm:5.28.4" peerDependencies: @@ -1307,71 +1307,71 @@ __metadata: peerDependenciesMeta: "@react-native-async-storage/async-storage": optional: true - checksum: 10/e61a500b1d67cc1cdc3fff824f20400deb480a0015db1eaee5744026329bbc87d8c755ae6da8b22b9aed0fd42e0d6684c67cc1bb47697152f3e82bb7ae416b26 + checksum: 10/b8e66c7a272b0a6a5e63768425761a28995dda1104a80d6a4590b250145b2ec5fc5852306916921970f4b0a7e76dc399cf1c44fb0d40f81688a0a9377aabad88 languageName: node linkType: hard -"@firebase/component@npm:0.6.7": - version: 0.6.7 - resolution: "@firebase/component@npm:0.6.7" +"@firebase/component@npm:0.6.8": + version: 0.6.8 + resolution: "@firebase/component@npm:0.6.8" dependencies: - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" - checksum: 10/b41a1c654c6da7ed2570c403dac118b3633d05dc8d9769057fdb66ec04f2f3a8dcb7cff4a87dd5a0b9fa614854586d4376b5aadee6876450c1ee851b59d5b0da + checksum: 10/0df2a61a9d3a32981a82889b4f23923c9adc468e89cadec5984b52d2422bb2b184c1219ed78dc7ec0b7f973ac0b7c2e8f486dee4a32a6741c0627648960e4314 languageName: node linkType: hard -"@firebase/database-compat@npm:1.0.5": - version: 1.0.5 - resolution: "@firebase/database-compat@npm:1.0.5" +"@firebase/database-compat@npm:1.0.6": + version: 1.0.6 + resolution: "@firebase/database-compat@npm:1.0.6" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/database": "npm:1.0.5" - "@firebase/database-types": "npm:1.0.3" + "@firebase/component": "npm:0.6.8" + "@firebase/database": "npm:1.0.6" + "@firebase/database-types": "npm:1.0.4" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" - checksum: 10/e7256f2675860340d560143ef40af9d9e1d941798c166e97b95be3c278068524dfceac9a59fe689a8c6c3704a84faae674601f8504a481521dff43dbc3063b1f + checksum: 10/a4bd30a47bb17de6c1b9508b0141f94a25fa8b73c7f85451200390fcdb6500cdb5e1f14bc699e001798f5552b75a7884cf59361d0eb450374504781e64393a66 languageName: node linkType: hard -"@firebase/database-types@npm:1.0.3": - version: 1.0.3 - resolution: "@firebase/database-types@npm:1.0.3" +"@firebase/database-types@npm:1.0.4": + version: 1.0.4 + resolution: "@firebase/database-types@npm:1.0.4" dependencies: "@firebase/app-types": "npm:0.9.2" - "@firebase/util": "npm:1.9.6" - checksum: 10/ecc36c54552b42b063011d8c58d1645ac3a09a7da36b2cebd25774a1be7d8aa79f752671f75025df44c079289d0c4f42de3cfcdb48cd7fc73539ba93fdcfb476 + "@firebase/util": "npm:1.9.7" + checksum: 10/d76125998d322d1fa31a6bf028e21ba03eafb26d7ae3b408ea8f84f52caf1dea716a236a21c64deb857c5eb091ea53cf148b9a2b99f4e97efc5b7c8cabae9acd languageName: node linkType: hard -"@firebase/database@npm:1.0.5": - version: 1.0.5 - resolution: "@firebase/database@npm:1.0.5" +"@firebase/database@npm:1.0.6": + version: 1.0.6 + resolution: "@firebase/database@npm:1.0.6" dependencies: "@firebase/app-check-interop-types": "npm:0.3.2" "@firebase/auth-interop-types": "npm:0.2.3" - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" faye-websocket: "npm:0.11.4" tslib: "npm:^2.1.0" - checksum: 10/1ea0bb014af9e1134f68868a2cfe97befae5c252cc728342d2f8b51ce06df2085dc87b443339eebd4a622c49abdd583bbe2ebf3bd3ac6cad0c148f4a61612c42 + checksum: 10/9d55b61624934703f1636692e4e6765ade127cb636a0d3adda75889cb2be4735eb03347caf4f0184eaef829ade11c5ab210df0327b1ae629f8f0484faa1f8124 languageName: node linkType: hard -"@firebase/firestore-compat@npm:0.3.32": - version: 0.3.32 - resolution: "@firebase/firestore-compat@npm:0.3.32" +"@firebase/firestore-compat@npm:0.3.33": + version: 0.3.33 + resolution: "@firebase/firestore-compat@npm:0.3.33" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/firestore": "npm:4.6.3" + "@firebase/component": "npm:0.6.8" + "@firebase/firestore": "npm:4.6.4" "@firebase/firestore-types": "npm:3.0.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/65ff915c6c1bb3ccc580887c91d7bb6470fbbb4035f3db24dc91ce297391ceb3d12ce2e311b8c7bcac7976e625089e8871cfe0e6a3c22d85945bb34b3022dc0a + checksum: 10/9e0ebf53487af218ad4f3ef67caf4acb29baac087530a0cbcc7296a194aa03da53572f7792bf1db5a819cec2b6a5336b4187cc63084deac518802fe44aee385b languageName: node linkType: hard @@ -1385,36 +1385,36 @@ __metadata: languageName: node linkType: hard -"@firebase/firestore@npm:4.6.3": - version: 4.6.3 - resolution: "@firebase/firestore@npm:4.6.3" +"@firebase/firestore@npm:4.6.4": + version: 4.6.4 + resolution: "@firebase/firestore@npm:4.6.4" dependencies: - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" - "@firebase/webchannel-wrapper": "npm:1.0.0" + "@firebase/util": "npm:1.9.7" + "@firebase/webchannel-wrapper": "npm:1.0.1" "@grpc/grpc-js": "npm:~1.9.0" "@grpc/proto-loader": "npm:^0.7.8" tslib: "npm:^2.1.0" undici: "npm:5.28.4" peerDependencies: "@firebase/app": 0.x - checksum: 10/a2edab1abb1ff2abb891c490bb81aa698128493847256c3ae7f20eefa97b51442c2689c0659c8e1daeb7f054d06687b6ae3db0680396a338d3228e8865933bd2 + checksum: 10/31df78e2157f74dfa00c634eeea27853923db679df438786432503fc9099616a2ac42dd32d9098d14a6f221b0e2572c9e29fd0231c34651c8216352729d6cc0c languageName: node linkType: hard -"@firebase/functions-compat@npm:0.3.11": - version: 0.3.11 - resolution: "@firebase/functions-compat@npm:0.3.11" +"@firebase/functions-compat@npm:0.3.12": + version: 0.3.12 + resolution: "@firebase/functions-compat@npm:0.3.12" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/functions": "npm:0.11.5" + "@firebase/component": "npm:0.6.8" + "@firebase/functions": "npm:0.11.6" "@firebase/functions-types": "npm:0.6.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/271609ea2d95a333b1fab1ed1d4dcec9b92299253f9a310519b1ee70d61be87029da75dd852ce736179c21886bd2f04bb7aee299e731ef88d9ebe3d00540b61a + checksum: 10/d9803c909e848dc381c892d36885a9519b5b025a46afb2c096bf099e840c5c0afc2290b5660a9d763cf6a8bf0ad6f303f85d3011abfc02d75348452bfe3200c8 languageName: node linkType: hard @@ -1425,35 +1425,35 @@ __metadata: languageName: node linkType: hard -"@firebase/functions@npm:0.11.5": - version: 0.11.5 - resolution: "@firebase/functions@npm:0.11.5" +"@firebase/functions@npm:0.11.6": + version: 0.11.6 + resolution: "@firebase/functions@npm:0.11.6" dependencies: "@firebase/app-check-interop-types": "npm:0.3.2" "@firebase/auth-interop-types": "npm:0.2.3" - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/messaging-interop-types": "npm:0.2.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" undici: "npm:5.28.4" peerDependencies: "@firebase/app": 0.x - checksum: 10/839dd2d9a4a9321bb53d210729246fe4db97e7c26dc562ee1b0c95579b111534fd4a27962e19d2a84cd35f62e0ef75d89c06ffa1177d0a178740cfdcf5325162 + checksum: 10/c1ac2887dd986c8abc408db1da26531f5f9d252f2cd4ee36352239ed0a0fc11902dd1f85db9ec21818028fd737c5a09461c01c0701c85f9ea96b9dc8dfc69f03 languageName: node linkType: hard -"@firebase/installations-compat@npm:0.2.7": - version: 0.2.7 - resolution: "@firebase/installations-compat@npm:0.2.7" +"@firebase/installations-compat@npm:0.2.8": + version: 0.2.8 + resolution: "@firebase/installations-compat@npm:0.2.8" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/installations": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" + "@firebase/installations": "npm:0.6.8" "@firebase/installations-types": "npm:0.5.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/b32f9ba4b7d6cdb6c932da28ebbd29a7c398065ec4bf353ac40cb2fc8b2f5a77608759635ade41b6d5e2c8f2047e1710beeb3babdfe116d8fc9c6b693ce922aa + checksum: 10/b0eece054763ac6d229b2fca7ead9cbdd10e6c8429be9f03d95e8ed4a488fcf1cbc3a136f49800b07f2b82fb0f5ff1fecb41bee923aa045314ed854bada256d8 languageName: node linkType: hard @@ -1466,17 +1466,17 @@ __metadata: languageName: node linkType: hard -"@firebase/installations@npm:0.6.7": - version: 0.6.7 - resolution: "@firebase/installations@npm:0.6.7" +"@firebase/installations@npm:0.6.8": + version: 0.6.8 + resolution: "@firebase/installations@npm:0.6.8" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/util": "npm:1.9.6" + "@firebase/component": "npm:0.6.8" + "@firebase/util": "npm:1.9.7" idb: "npm:7.1.1" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10/643bc8f1e908b2edadbda422e86753c8599e94744f1e2c4e4ae60059d32c4001c76d3fd63377a53bc49e31e991fbfa2f0c31a46dd69ed3151cc7c96316184b6c + checksum: 10/84cdf30d393fad859f035b276c0ef372cd94907fe042498cdd7c24a719d786866a2f976834b90a49c543e37ae317edd669676830ba7cd83f3a3d34b6f2c0f1ee languageName: node linkType: hard @@ -1489,17 +1489,17 @@ __metadata: languageName: node linkType: hard -"@firebase/messaging-compat@npm:0.2.9": - version: 0.2.9 - resolution: "@firebase/messaging-compat@npm:0.2.9" +"@firebase/messaging-compat@npm:0.2.10": + version: 0.2.10 + resolution: "@firebase/messaging-compat@npm:0.2.10" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/messaging": "npm:0.12.9" - "@firebase/util": "npm:1.9.6" + "@firebase/component": "npm:0.6.8" + "@firebase/messaging": "npm:0.12.10" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/15140fc298bdd28b28fd052eb630770c4388887a9a1d29afa11d4e74cccd3238826fae97e7beb4196a286fe0555023f836442508f13776c6e371bf610819aa5d + checksum: 10/3565546cc935f553c0331dc86e593cd39e09c198c549e801dfb9d4ee53152fcc3bab277355bf1a82a063506b8462038dbd3d2122178b9c1edd39c08a0503244d languageName: node linkType: hard @@ -1510,35 +1510,35 @@ __metadata: languageName: node linkType: hard -"@firebase/messaging@npm:0.12.9": - version: 0.12.9 - resolution: "@firebase/messaging@npm:0.12.9" +"@firebase/messaging@npm:0.12.10": + version: 0.12.10 + resolution: "@firebase/messaging@npm:0.12.10" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/installations": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" + "@firebase/installations": "npm:0.6.8" "@firebase/messaging-interop-types": "npm:0.2.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" idb: "npm:7.1.1" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10/67ace395630a858f990513398ea2055cbbf6c167f47068c62cc9eb342a6ab459a3fcb0f2f7b26c1c7027cb79a5e67e4124602723ed9e2ac483153981b91206e0 + checksum: 10/c883b465da2cdee0e08f37119bcb4eb1152bec482fe87136f4dbc6fc9ffbbba1f7c25fff70948844633949ab77bc38d81afd31e7227bf398863cccb878be3095 languageName: node linkType: hard -"@firebase/performance-compat@npm:0.2.7": - version: 0.2.7 - resolution: "@firebase/performance-compat@npm:0.2.7" +"@firebase/performance-compat@npm:0.2.8": + version: 0.2.8 + resolution: "@firebase/performance-compat@npm:0.2.8" dependencies: - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/performance": "npm:0.6.7" + "@firebase/performance": "npm:0.6.8" "@firebase/performance-types": "npm:0.2.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/346cc57378384377c4001dfc84322ece4bcebfbcfb7547e9629576ee527c89b257f763afd2e72640c32732006360976abd26c3e17734dd23398b1165bd3e0b9a + checksum: 10/354a31f31c0d07df10a2b33f4ef2b34ba931cb51738c533c5af9e85c1645d9421f2262ec72eb54a3821f1df52644254f92b866d836c528d6a8ff91b399a2aad4 languageName: node linkType: hard @@ -1549,34 +1549,34 @@ __metadata: languageName: node linkType: hard -"@firebase/performance@npm:0.6.7": - version: 0.6.7 - resolution: "@firebase/performance@npm:0.6.7" +"@firebase/performance@npm:0.6.8": + version: 0.6.8 + resolution: "@firebase/performance@npm:0.6.8" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/installations": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" + "@firebase/installations": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10/760b942ad58d73fc6a6b28ff90d59c67fbf5405dc99e2c0fbaa604eecb1fb82419992763c0e59a92147e6cf7d43c1e32ee7cccd39d0706416263bf9684b19a27 + checksum: 10/5c989d154daea84f009f221245231bf5050cf0d96688bf1b20add98429088c815cc6e76e91180394c9d7fe5759094bbe4261c13604ff349c67e3d7113959b146 languageName: node linkType: hard -"@firebase/remote-config-compat@npm:0.2.7": - version: 0.2.7 - resolution: "@firebase/remote-config-compat@npm:0.2.7" +"@firebase/remote-config-compat@npm:0.2.8": + version: 0.2.8 + resolution: "@firebase/remote-config-compat@npm:0.2.8" dependencies: - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/remote-config": "npm:0.4.7" + "@firebase/remote-config": "npm:0.4.8" "@firebase/remote-config-types": "npm:0.3.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/d8e729bb1e5da61a6d0c23dc410a43c404acdd2794cc880a311571354727299ec64936f3dc31b7081786a18cb4e39e12299d8ac4d264af6527fdaecbc5bf0fb3 + checksum: 10/342b27720635c7f68ce8953cd22a5badfc628c3fb9414b32d40a2eaacb2feb2068079eac15c3c811f4327a06d01aa71631a6f2cfe8b80460f1910cfd37126342 languageName: node linkType: hard @@ -1587,33 +1587,33 @@ __metadata: languageName: node linkType: hard -"@firebase/remote-config@npm:0.4.7": - version: 0.4.7 - resolution: "@firebase/remote-config@npm:0.4.7" +"@firebase/remote-config@npm:0.4.8": + version: 0.4.8 + resolution: "@firebase/remote-config@npm:0.4.8" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/installations": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" + "@firebase/installations": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x - checksum: 10/9fc4699921d20fbd030e1349fd53baaf06faf67c097158993249be295e51fc93117b8efd6c8f13d07353b72a1dd282cbf5ddd12f7bdcaa8f2ea35e3769210be1 + checksum: 10/58f934b8cdc8582f260a8caf5b903d484d74aecba420221bf57e5df28f8ba7d3f9ca1ab58946c90ab2c29659bbfdad679fc59247468068063a5329d92cd27613 languageName: node linkType: hard -"@firebase/storage-compat@npm:0.3.8": - version: 0.3.8 - resolution: "@firebase/storage-compat@npm:0.3.8" +"@firebase/storage-compat@npm:0.3.9": + version: 0.3.9 + resolution: "@firebase/storage-compat@npm:0.3.9" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/storage": "npm:0.12.5" + "@firebase/component": "npm:0.6.8" + "@firebase/storage": "npm:0.12.6" "@firebase/storage-types": "npm:0.8.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app-compat": 0.x - checksum: 10/9c92e3f8e72946cc926c8ceb4098589df72d41e677dd7177a27517f98a3d6bda094b96c3370eca1c21bcb59166fbc4480d053255ae81649b7c12b10bed9fdb7b + checksum: 10/4b5a35bcac07684dacc181e9cd7a6ba0350df1acc0d7c18b4dae861dc2876194224a0595965dc94ee3424fadeacd28fdbf808a7d19162f3c2f9b35242fc56ff3 languageName: node linkType: hard @@ -1627,49 +1627,49 @@ __metadata: languageName: node linkType: hard -"@firebase/storage@npm:0.12.5": - version: 0.12.5 - resolution: "@firebase/storage@npm:0.12.5" +"@firebase/storage@npm:0.12.6": + version: 0.12.6 + resolution: "@firebase/storage@npm:0.12.6" dependencies: - "@firebase/component": "npm:0.6.7" - "@firebase/util": "npm:1.9.6" + "@firebase/component": "npm:0.6.8" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" undici: "npm:5.28.4" peerDependencies: "@firebase/app": 0.x - checksum: 10/e8d3241f1851338f33ab954eb636b464fdd75f2800bdba56d52e807c99f5c6b4ac3f59ff35a836377fb28f72709310af7ba5daba9b8138f9173a621fc2231ca0 + checksum: 10/4f00195374b083b6144a2e7f608391a0ac22e4165235177a447b4211199bf10f37b78a493b6fda164fe09381c309346faa341a8d216757ccd693843c899c7697 languageName: node linkType: hard -"@firebase/util@npm:1.9.6": - version: 1.9.6 - resolution: "@firebase/util@npm:1.9.6" +"@firebase/util@npm:1.9.7": + version: 1.9.7 + resolution: "@firebase/util@npm:1.9.7" dependencies: tslib: "npm:^2.1.0" - checksum: 10/4037241991fefd28df19a38a638b8befb01e3d23b111623986256113604c485c3cca4c761de9888f6271da736dc10f0e8311b47f693d574ea46323c5bfd9abdb + checksum: 10/c31290f45794af68a3ab571db1c0e3cb4d15443adfdc50107b835274b4ad525f839ee79a0da2898dd8b31e64ff811c126d338b0bab117be59c0a065ce984a89a languageName: node linkType: hard -"@firebase/vertexai-preview@npm:0.0.2": - version: 0.0.2 - resolution: "@firebase/vertexai-preview@npm:0.0.2" +"@firebase/vertexai-preview@npm:0.0.3": + version: 0.0.3 + resolution: "@firebase/vertexai-preview@npm:0.0.3" dependencies: "@firebase/app-check-interop-types": "npm:0.3.2" - "@firebase/component": "npm:0.6.7" + "@firebase/component": "npm:0.6.8" "@firebase/logger": "npm:0.4.2" - "@firebase/util": "npm:1.9.6" + "@firebase/util": "npm:1.9.7" tslib: "npm:^2.1.0" peerDependencies: "@firebase/app": 0.x "@firebase/app-types": 0.x - checksum: 10/00ebde87389d85023101b727f2a54af0263a1ab2ad238a9d395672aeb135a023c980a862713b7df6343669be8a10cf8560a1f77da8ceddb0aef2703918c90973 + checksum: 10/490ea78f153b764e117989cb0ee9abeb0f456c6daefc58aa949147b1404a2d90d49c84a04556f8d84a729692ca99ed670b9dd9b37169b93ac01dc8d9242dac13 languageName: node linkType: hard -"@firebase/webchannel-wrapper@npm:1.0.0": - version: 1.0.0 - resolution: "@firebase/webchannel-wrapper@npm:1.0.0" - checksum: 10/007307141753c87d62f94ebe3365bc6d610ccbd1ac13b1b4584ed74452f874a830db69b781e4decc509c1327133df1169eecd39bdccb3c7b3b34ea30f2d884a5 +"@firebase/webchannel-wrapper@npm:1.0.1": + version: 1.0.1 + resolution: "@firebase/webchannel-wrapper@npm:1.0.1" + checksum: 10/22fc7e1e6dd36ab7c13f3a6c1ff51f4d405304424dc323cb146109e7a3ab3b592e2ddb29f53197ee5719a8448cdedb98d9e86a080f9365e389f8429b1c6555c2 languageName: node linkType: hard @@ -2066,9 +2066,9 @@ __metadata: linkType: hard "@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.15": - version: 1.4.15 - resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" - checksum: 10/89960ac087781b961ad918978975bcdf2051cd1741880469783c42de64239703eab9db5230d776d8e6a09d73bb5e4cb964e07d93ee6e2e7aea5a7d726e865c09 + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 10/4ed6123217569a1484419ac53f6ea0d9f3b57e5b57ab30d7c267bdb27792a27eb0e4b08e84a2680aa55cc2f2b411ffd6ec3db01c44fdc6dc43aca4b55f8374fd languageName: node linkType: hard @@ -2184,12 +2184,12 @@ __metadata: linkType: hard "@metamask/abi-utils@npm:^2.0.2, @metamask/abi-utils@npm:^2.0.3": - version: 2.0.3 - resolution: "@metamask/abi-utils@npm:2.0.3" + version: 2.0.4 + resolution: "@metamask/abi-utils@npm:2.0.4" dependencies: - "@metamask/superstruct": "npm:^3.0.0" - "@metamask/utils": "npm:^8.5.0" - checksum: 10/a2dfc0b3586bd335f44c4dbc37ff2cd05cd0f569918d0307fc64af3f8200fd880ac6eba9483978cc7f23465fc75eff26fb9e3d1dd8e02e90f146e646d8d28df6 + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.0.0" + checksum: 10/3d32d42c6e98fc4719b2b53597e573764b80936c7cc31d884c87729c4c4f74a30e93096db87aaa7cbcec9d3bb7d22b1adfc98a8bcb4c7c2f17bfbddaa4367d34 languageName: node linkType: hard @@ -3114,7 +3114,7 @@ __metadata: "@metamask/keyring-api@github:MetaMask/keyring-api#replace-superstruct-with-fork": version: 8.0.0 - resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=6ec0879a3d7bf467c850e7dd17728aa9119aa68c" + resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=3dcfc81f99360d7920e1c52625599ee8d2d1a55e" dependencies: "@metamask/providers": "npm:17.0.0" "@metamask/snaps-sdk": "npm:^6.0.0" @@ -3125,7 +3125,7 @@ __metadata: uuid: "npm:^9.0.1" peerDependencies: "@metamask/providers": ">=15 <18" - checksum: 10/2170cddf5c518699e8e5f3f2f6a6ef532ca06887c8e3cbe393e1a4b0162a92a4f954fc25ea71aaa1bb06df64ff933fba02690a00282c0ec6bebf7352d5e57e08 + checksum: 10/00dfcadaab242b790537b8928a436cedb0c2da860f7ff45d13079adaf73126bd5f208a4d173a1b7077a83c27dc259281a44e2770255cb197c231b7eb49280e2c languageName: node linkType: hard @@ -3921,7 +3921,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0, @metamask/utils@npm:^8.5.0": +"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0": version: 8.5.0 resolution: "@metamask/utils@npm:8.5.0" dependencies: @@ -3986,12 +3986,12 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.4.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.4.0": - version: 1.4.0 - resolution: "@noble/curves@npm:1.4.0" +"@noble/curves@npm:1.4.2, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.4.0": + version: 1.4.2 + resolution: "@noble/curves@npm:1.4.2" dependencies: "@noble/hashes": "npm:1.4.0" - checksum: 10/b21b30a36ff02bfcc0f5e6163d245cdbaf7f640511fff97ccf83fc207ee79cfd91584b4d97977374de04cb118a55eb63a7964c82596a64162bbc42bc685ae6d9 + checksum: 10/f433a2e8811ae345109388eadfa18ef2b0004c1f79417553241db4f0ad0d59550be6298a4f43d989c627e9f7551ffae6e402a4edf0173981e6da95fc7cab5123 languageName: node linkType: hard @@ -4066,10 +4066,11 @@ __metadata: linkType: hard "@npmcli/git@npm:^5.0.0": - version: 5.0.7 - resolution: "@npmcli/git@npm:5.0.7" + version: 5.0.8 + resolution: "@npmcli/git@npm:5.0.8" dependencies: "@npmcli/promise-spawn": "npm:^7.0.0" + ini: "npm:^4.1.3" lru-cache: "npm:^10.0.1" npm-pick-manifest: "npm:^9.0.0" proc-log: "npm:^4.0.0" @@ -4077,7 +4078,7 @@ __metadata: promise-retry: "npm:^2.0.1" semver: "npm:^7.3.5" which: "npm:^4.0.0" - checksum: 10/73b48213109cc3943e977054d3747ec84ba5f2b809df8899242d27d4f574752f9151330996f632e76a546b0e6d13e25a4a70465b8a34c38a38ca4148024a5ceb + checksum: 10/e6f94175fb9dde13d84849b29b32ffb4c4df968822cc85df2aebfca13bf8ca76f33b1d281911f5bcddc95bccba2f9e795669c736a38de4d9c76efb5047ffb4fb languageName: node linkType: hard @@ -4212,114 +4213,114 @@ __metadata: languageName: node linkType: hard -"@rollup/rollup-android-arm-eabi@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-android-arm-eabi@npm:4.18.0" +"@rollup/rollup-android-arm-eabi@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.18.1" conditions: os=android & cpu=arm languageName: node linkType: hard -"@rollup/rollup-android-arm64@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-android-arm64@npm:4.18.0" +"@rollup/rollup-android-arm64@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-android-arm64@npm:4.18.1" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-arm64@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-darwin-arm64@npm:4.18.0" +"@rollup/rollup-darwin-arm64@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-darwin-arm64@npm:4.18.1" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-darwin-x64@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-darwin-x64@npm:4.18.0" +"@rollup/rollup-darwin-x64@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-darwin-x64@npm:4.18.1" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@rollup/rollup-linux-arm-gnueabihf@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.18.0" +"@rollup/rollup-linux-arm-gnueabihf@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.18.1" conditions: os=linux & cpu=arm & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm-musleabihf@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.18.0" +"@rollup/rollup-linux-arm-musleabihf@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.18.1" conditions: os=linux & cpu=arm & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-arm64-gnu@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.18.0" +"@rollup/rollup-linux-arm64-gnu@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.18.1" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-arm64-musl@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-arm64-musl@npm:4.18.0" +"@rollup/rollup-linux-arm64-musl@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.18.1" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.0" +"@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.1" conditions: os=linux & cpu=ppc64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-riscv64-gnu@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.18.0" +"@rollup/rollup-linux-riscv64-gnu@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.18.1" conditions: os=linux & cpu=riscv64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-s390x-gnu@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.18.0" +"@rollup/rollup-linux-s390x-gnu@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.18.1" conditions: os=linux & cpu=s390x & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-gnu@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-x64-gnu@npm:4.18.0" +"@rollup/rollup-linux-x64-gnu@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.18.1" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@rollup/rollup-linux-x64-musl@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-linux-x64-musl@npm:4.18.0" +"@rollup/rollup-linux-x64-musl@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.18.1" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@rollup/rollup-win32-arm64-msvc@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.18.0" +"@rollup/rollup-win32-arm64-msvc@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.18.1" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@rollup/rollup-win32-ia32-msvc@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.18.0" +"@rollup/rollup-win32-ia32-msvc@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.18.1" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@rollup/rollup-win32-x64-msvc@npm:4.18.0": - version: 4.18.0 - resolution: "@rollup/rollup-win32-x64-msvc@npm:4.18.0" +"@rollup/rollup-win32-x64-msvc@npm:4.18.1": + version: 4.18.1 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.18.1" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -4657,9 +4658,9 @@ __metadata: linkType: hard "@types/lodash@npm:^4.14.191": - version: 4.17.5 - resolution: "@types/lodash@npm:4.17.5" - checksum: 10/10e2e9cbeb16998026f4071f9f5f2a38b651eba15302f512e0b8ab904c07c197ca0282d2821f64e53c2b692d7046af0a1ce3ead190fb077cbe4036948fce1924 + version: 4.17.6 + resolution: "@types/lodash@npm:4.17.6" + checksum: 10/6d3a68b3e795381f4aaf946855134d24eeb348ad5d66e9a44461d30026da82b215d55b92b70486d811ca45d54d4ab956aa2dced37fd04e19d49afe160ae3da2e languageName: node linkType: hard @@ -4678,11 +4679,11 @@ __metadata: linkType: hard "@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": - version: 20.14.9 - resolution: "@types/node@npm:20.14.9" + version: 20.14.10 + resolution: "@types/node@npm:20.14.10" dependencies: undici-types: "npm:~5.26.4" - checksum: 10/f313b06c79be92f5d3541159ef813b9fc606941f951ecf826e940658c6d4952755ca2f06277b746326cef0697ed79a04676ecde053d32e1121b3352c8168d2e9 + checksum: 10/672892cf94d0d95cf052f11271990686a0fd204cd1e5fe7a4ef240e5315e06711765dc47b9ec98627d3adac18b8c92bb7e2d8db21d18faa20bc3e3203a143e79 languageName: node linkType: hard @@ -4962,60 +4963,60 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-core@npm:3.4.30": - version: 3.4.30 - resolution: "@vue/compiler-core@npm:3.4.30" +"@vue/compiler-core@npm:3.4.31": + version: 3.4.31 + resolution: "@vue/compiler-core@npm:3.4.31" dependencies: "@babel/parser": "npm:^7.24.7" - "@vue/shared": "npm:3.4.30" + "@vue/shared": "npm:3.4.31" entities: "npm:^4.5.0" estree-walker: "npm:^2.0.2" source-map-js: "npm:^1.2.0" - checksum: 10/f076055678b8b2f440f2ad3a101f3762bdf8c0208ae96454f8cb689e57bf90d5cd6712e5cac8c5de5814d22213a8c75b96548173a2876cf384ca3bf2b734d74e + checksum: 10/1d83dd8c995984a0e7d80faaaa68956bbaadf01bb7cc07f29c5ebcf6aa5eeb2fa88db9d1a4aeb47f8b0b78eda7cc49688108b7fb5ac581eb5584ab59115dc99c languageName: node linkType: hard -"@vue/compiler-dom@npm:3.4.30": - version: 3.4.30 - resolution: "@vue/compiler-dom@npm:3.4.30" +"@vue/compiler-dom@npm:3.4.31": + version: 3.4.31 + resolution: "@vue/compiler-dom@npm:3.4.31" dependencies: - "@vue/compiler-core": "npm:3.4.30" - "@vue/shared": "npm:3.4.30" - checksum: 10/9f82a6e9c14879d96fe078631716c9fa81c900e5cfb60d71fcf78df90fa6512f967662f99ba78834e5695e8f0b91a5afb71d06a414e6b935d3dfa0d2d4ef7979 + "@vue/compiler-core": "npm:3.4.31" + "@vue/shared": "npm:3.4.31" + checksum: 10/5f58557222a8fd9c043e7bf3e00a273691c6e070ac5c87874a628387ece0dec5ed950070d538852264cdb2ecc4d7fb9e7d79d37bf2db05e0474c44e2083c2fbe languageName: node linkType: hard "@vue/compiler-sfc@npm:^3.3.4": - version: 3.4.30 - resolution: "@vue/compiler-sfc@npm:3.4.30" + version: 3.4.31 + resolution: "@vue/compiler-sfc@npm:3.4.31" dependencies: "@babel/parser": "npm:^7.24.7" - "@vue/compiler-core": "npm:3.4.30" - "@vue/compiler-dom": "npm:3.4.30" - "@vue/compiler-ssr": "npm:3.4.30" - "@vue/shared": "npm:3.4.30" + "@vue/compiler-core": "npm:3.4.31" + "@vue/compiler-dom": "npm:3.4.31" + "@vue/compiler-ssr": "npm:3.4.31" + "@vue/shared": "npm:3.4.31" estree-walker: "npm:^2.0.2" magic-string: "npm:^0.30.10" postcss: "npm:^8.4.38" source-map-js: "npm:^1.2.0" - checksum: 10/34778dab0d532e6a9f1bff6a24d81aa6c528cf829dcee7b495d6277d1a953f6d135b94109656a3b92075ecfbb6fd351da09b665719691fd441df5085399d2f1e + checksum: 10/87dcddecfcfedb01603c08ee66286c7703a0ec76e89e5ba06b18c5309480ff7ffa7ff062585213de00527dd96995720a57f8fec8b6ea9b5851db1c72afa7baee languageName: node linkType: hard -"@vue/compiler-ssr@npm:3.4.30": - version: 3.4.30 - resolution: "@vue/compiler-ssr@npm:3.4.30" +"@vue/compiler-ssr@npm:3.4.31": + version: 3.4.31 + resolution: "@vue/compiler-ssr@npm:3.4.31" dependencies: - "@vue/compiler-dom": "npm:3.4.30" - "@vue/shared": "npm:3.4.30" - checksum: 10/2fd1f05055a7cbaeb809878b66025c89c3e855d6254c0ad63ebbee2f28782026461759d97bc8be6aea54658415c21d43f32f9f05725c819453c1fd790ed8e330 + "@vue/compiler-dom": "npm:3.4.31" + "@vue/shared": "npm:3.4.31" + checksum: 10/88470b9cc4b19a541f2c65946db5d60883507ba438dea4538906e7845abba4562ed7f1d277664cdbb5507d6c62fc138c17fd65e9dcfd7a68ce081c6e762df515 languageName: node linkType: hard -"@vue/shared@npm:3.4.30": - version: 3.4.30 - resolution: "@vue/shared@npm:3.4.30" - checksum: 10/82c55bd70b1b42c796606a998f9f96356c4eff0ced24f0bc64a8ed67e9cead3fda1ff543f429442b04868186da258c2e8cdbaed49d51a254ab99765b88d63947 +"@vue/shared@npm:3.4.31": + version: 3.4.31 + resolution: "@vue/shared@npm:3.4.31" + checksum: 10/ec11ba892b6f6f078fd620e5a2c16d57935f69e7a3dbae20c18e79c70e1bc89fa6d463d5fcbb220f54e9e4122dbc0bb04024059afecd6acf6b182d3c071e3c3a languageName: node linkType: hard @@ -5094,11 +5095,11 @@ __metadata: linkType: hard "acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.12.0 - resolution: "acorn@npm:8.12.0" + version: 8.12.1 + resolution: "acorn@npm:8.12.1" bin: acorn: bin/acorn - checksum: 10/550cc5033184eb98f7fbe2e9ddadd0f47f065734cc682f25db7a244f52314eb816801b64dec7174effd978045bd1754892731a90b1102b0ede9d17a15cfde138 + checksum: 10/d08c2d122bba32d0861e0aa840b2ee25946c286d5dc5990abca991baf8cdbfbe199b05aacb221b979411a2fea36f83e26b5ac4f6b4e0ce49038c62316c1848f0 languageName: node linkType: hard @@ -5157,14 +5158,14 @@ __metadata: linkType: hard "ajv@npm:^8.0.1": - version: 8.16.0 - resolution: "ajv@npm:8.16.0" + version: 8.17.1 + resolution: "ajv@npm:8.17.1" dependencies: fast-deep-equal: "npm:^3.1.3" + fast-uri: "npm:^3.0.1" json-schema-traverse: "npm:^1.0.0" require-from-string: "npm:^2.0.2" - uri-js: "npm:^4.4.1" - checksum: 10/9b4b380efaf8be2639736d535662bd142a6972b43075b404380165c37ab6ceb72f01c7c987536747ff3e9e21eb5cd2e2a194f1e0fa8355364ea6204b1262fcd1 + checksum: 10/ee3c62162c953e91986c838f004132b6a253d700f1e51253b99791e2dbfdb39161bc950ebdc2f156f8568035bb5ed8be7bd78289cd9ecbf3381fe8f5b82e3f33 languageName: node linkType: hard @@ -5549,11 +5550,11 @@ __metadata: linkType: hard "base-x@npm:^3.0.2": - version: 3.0.9 - resolution: "base-x@npm:3.0.9" + version: 3.0.10 + resolution: "base-x@npm:3.0.10" dependencies: safe-buffer: "npm:^5.0.1" - checksum: 10/957101d6fd09e1903e846fd8f69fd7e5e3e50254383e61ab667c725866bec54e5ece5ba49ce385128ae48f9ec93a26567d1d5ebb91f4d56ef4a9cc0d5a5481e8 + checksum: 10/52307739559e81d9980889de2359cb4f816cc0eb9a463028fa3ab239ab913d9044a1b47b4520f98e68453df32a457b8ba58b8d0ee7e757fc3fb971f3fa7a1482 languageName: node linkType: hard @@ -5731,17 +5732,17 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.22.2": - version: 4.23.1 - resolution: "browserslist@npm:4.23.1" +"browserslist@npm:^4.23.1": + version: 4.23.2 + resolution: "browserslist@npm:4.23.2" dependencies: - caniuse-lite: "npm:^1.0.30001629" - electron-to-chromium: "npm:^1.4.796" + caniuse-lite: "npm:^1.0.30001640" + electron-to-chromium: "npm:^1.4.820" node-releases: "npm:^2.0.14" - update-browserslist-db: "npm:^1.0.16" + update-browserslist-db: "npm:^1.1.0" bin: browserslist: cli.js - checksum: 10/91da59f70a8e01ece97133670f9857d6d7e96be78e1b7ffa54b869f97d01d01c237612471b595cee41c1ab212e26e536ce0b6716ad1d6c4368a40c222698cac1 + checksum: 10/326a98b1c39bcc9a99b197f15790dc28e122b1aead3257c837421899377ac96239123f26868698085b3d9be916d72540602738e1f857e86a387e810af3fda6e5 languageName: node linkType: hard @@ -5845,8 +5846,8 @@ __metadata: linkType: hard "cacache@npm:^18.0.0": - version: 18.0.3 - resolution: "cacache@npm:18.0.3" + version: 18.0.4 + resolution: "cacache@npm:18.0.4" dependencies: "@npmcli/fs": "npm:^3.1.0" fs-minipass: "npm:^3.0.0" @@ -5860,7 +5861,7 @@ __metadata: ssri: "npm:^10.0.0" tar: "npm:^6.1.11" unique-filename: "npm:^3.0.0" - checksum: 10/d4c161f071524bb636334b8cf94780c014e29c180a886b8184da8f2f44d2aca88d5664797c661e9f74bdbd34697c2f231ed7c24c256cecbb0a0563ad1ada2219 + checksum: 10/ca2f7b2d3003f84d362da9580b5561058ccaecd46cba661cbcff0375c90734b610520d46b472a339fd032d91597ad6ed12dde8af81571197f3c9772b5d35b104 languageName: node linkType: hard @@ -5912,10 +5913,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001629": - version: 1.0.30001636 - resolution: "caniuse-lite@npm:1.0.30001636" - checksum: 10/9e6c5ab4c20df31df36720dda77cf6a781549ac2ad844bc0a416b327a793da21486358a1f85fdd6c39e22d336f70aac3b0e232f5f228cdff0ceb6e3e1c5e98fd +"caniuse-lite@npm:^1.0.30001640": + version: 1.0.30001642 + resolution: "caniuse-lite@npm:1.0.30001642" + checksum: 10/8d80ea82be453ae0fdfea8766d82740a4945c1b99189650f29bfc458d4e235d7e99027a8f8bc5a4228d8c4457ba896315284b0703f300353ad5f09d8e693de10 languageName: node linkType: hard @@ -6217,21 +6218,21 @@ __metadata: linkType: hard "contentful-sdk-core@npm:^8.1.0": - version: 8.1.4 - resolution: "contentful-sdk-core@npm:8.1.4" + version: 8.3.1 + resolution: "contentful-sdk-core@npm:8.3.1" dependencies: fast-copy: "npm:^2.1.7" lodash.isplainobject: "npm:^4.0.6" lodash.isstring: "npm:^4.0.1" p-throttle: "npm:^4.1.1" qs: "npm:^6.11.2" - checksum: 10/187cc9875d5dcc8c1cce90caa19820c252b37ab65e6cd9f3e043a94f0287bb87961b173f5c4b1da00dfa0c13307bd471c9bca152e06ddc273aa20fbe50f57296 + checksum: 10/645d3a5d296d0e2a5ce87cceb04cf1ddf572183b5946cb1b3b717436bc7be96864216225fb845e61850d580436021c6284e7c95da0600a16c89c0af81a5f0d2c languageName: node linkType: hard "contentful@npm:^10.3.6": - version: 10.12.4 - resolution: "contentful@npm:10.12.4" + version: 10.12.8 + resolution: "contentful@npm:10.12.8" dependencies: "@contentful/content-source-maps": "npm:^0.6.0" "@contentful/rich-text-types": "npm:^16.0.2" @@ -6240,7 +6241,7 @@ __metadata: contentful-sdk-core: "npm:^8.1.0" json-stringify-safe: "npm:^5.0.1" type-fest: "npm:^4.0.0" - checksum: 10/8aacd974a36f7119c77464d0f9d611dba1b2b45d909fa5e690c1c925132639fbb15ac8ceee4ae65f17a8fd50945595d5972952dda47689089f08b03da75edee2 + checksum: 10/fc9ba49eb9d3bdfebc3d1c95a08e4118817752e75fe7f166cc0a2feb64952f1150ab974ed44a712dc1bd83b989d44894bf6d6604e6dc4b0f030a78e4f35d5c87 languageName: node linkType: hard @@ -6666,10 +6667,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.4.796": - version: 1.4.811 - resolution: "electron-to-chromium@npm:1.4.811" - checksum: 10/20f00911b65859424dede4157025532a7187fd896f5a002952f0cf8582f3fbe429e0b9d02cb529136855886b8d7167a1ba2d06332bdc4d29bab199c7f4e25e8e +"electron-to-chromium@npm:^1.4.820": + version: 1.4.827 + resolution: "electron-to-chromium@npm:1.4.827" + checksum: 10/7fa44aeebc5548874d33e417579d998d8e9a3d7b07fae22429ee7de5866c73b3158d56969146df3dcf44a222dcd91972ee786d0427f461e0c98bff79e408e782 languageName: node linkType: hard @@ -7205,11 +7206,11 @@ __metadata: linkType: hard "eslint-plugin-promise@npm:^6.1.1": - version: 6.2.0 - resolution: "eslint-plugin-promise@npm:6.2.0" + version: 6.4.0 + resolution: "eslint-plugin-promise@npm:6.4.0" peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 - checksum: 10/9d3598a1c754d1cfa92b292e441fa8583c5f420058db6bd0de750e2c2b76fa08683deed86e9c51668a7e54e6991d3d428fbcfbe9363a6c93a94c0d74a29f5d5e + checksum: 10/23da32294b8661e95d4243b7cc925aefe3522842d5f6e2a6f72d052f92cfd96536d592e5186be6eb471e477edc2fe20ca257e7e1b5a786a6e582be3d65fdc4f5 languageName: node linkType: hard @@ -7344,11 +7345,11 @@ __metadata: linkType: hard "esquery@npm:^1.4.0, esquery@npm:^1.4.2": - version: 1.5.0 - resolution: "esquery@npm:1.5.0" + version: 1.6.0 + resolution: "esquery@npm:1.6.0" dependencies: estraverse: "npm:^5.1.0" - checksum: 10/e65fcdfc1e0ff5effbf50fb4f31ea20143ae5df92bb2e4953653d8d40aa4bc148e0d06117a592ce4ea53eeab1dafdfded7ea7e22a5be87e82d73757329a1b01d + checksum: 10/c587fb8ec9ed83f2b1bc97cf2f6854cc30bf784a79d62ba08c6e358bf22280d69aee12827521cf38e69ae9761d23fb7fde593ce315610f85655c139d99b05e5a languageName: node linkType: hard @@ -7444,14 +7445,14 @@ __metadata: linkType: hard "ethereum-cryptography@npm:^2.0.0, ethereum-cryptography@npm:^2.1.2": - version: 2.2.0 - resolution: "ethereum-cryptography@npm:2.2.0" + version: 2.2.1 + resolution: "ethereum-cryptography@npm:2.2.1" dependencies: - "@noble/curves": "npm:1.4.0" + "@noble/curves": "npm:1.4.2" "@noble/hashes": "npm:1.4.0" "@scure/bip32": "npm:1.4.0" "@scure/bip39": "npm:1.3.0" - checksum: 10/cca045cd0704e350042a97f3f3f5501d25a2c56fe4b6e129a2ae8a2ff84f773bcca8af90f42429f7490a803fd9b145b2cf71ed92cf3745d9727aec0e0c3e0f83 + checksum: 10/ab123bbfe843500ac2d645ce9edc4bc814962ffb598db6bf8bf01fbecac656e6c81ff4cf2472f1734844bbcbad2bf658d8b699cb7248d768e0f06ae13ecf43b8 languageName: node linkType: hard @@ -7703,6 +7704,13 @@ __metadata: languageName: node linkType: hard +"fast-uri@npm:^3.0.1": + version: 3.0.1 + resolution: "fast-uri@npm:3.0.1" + checksum: 10/e8ee4712270de0d29eb0fbf41ffad0ac80952e8797be760e8bb62c4707f08f50a86fe2d7829681ca133c07d6eb4b4a75389a5fc36674c5b254a3ac0891a68fc7 + languageName: node + linkType: hard + "fast-xml-parser@npm:^4.3.4": version: 4.4.0 resolution: "fast-xml-parser@npm:4.4.0" @@ -7819,37 +7827,37 @@ __metadata: linkType: hard "firebase@npm:^10.11.0": - version: 10.12.2 - resolution: "firebase@npm:10.12.2" - dependencies: - "@firebase/analytics": "npm:0.10.4" - "@firebase/analytics-compat": "npm:0.2.10" - "@firebase/app": "npm:0.10.5" - "@firebase/app-check": "npm:0.8.4" - "@firebase/app-check-compat": "npm:0.3.11" - "@firebase/app-compat": "npm:0.2.35" + version: 10.12.3 + resolution: "firebase@npm:10.12.3" + dependencies: + "@firebase/analytics": "npm:0.10.5" + "@firebase/analytics-compat": "npm:0.2.11" + "@firebase/app": "npm:0.10.6" + "@firebase/app-check": "npm:0.8.5" + "@firebase/app-check-compat": "npm:0.3.12" + "@firebase/app-compat": "npm:0.2.36" "@firebase/app-types": "npm:0.9.2" - "@firebase/auth": "npm:1.7.4" - "@firebase/auth-compat": "npm:0.5.9" - "@firebase/database": "npm:1.0.5" - "@firebase/database-compat": "npm:1.0.5" - "@firebase/firestore": "npm:4.6.3" - "@firebase/firestore-compat": "npm:0.3.32" - "@firebase/functions": "npm:0.11.5" - "@firebase/functions-compat": "npm:0.3.11" - "@firebase/installations": "npm:0.6.7" - "@firebase/installations-compat": "npm:0.2.7" - "@firebase/messaging": "npm:0.12.9" - "@firebase/messaging-compat": "npm:0.2.9" - "@firebase/performance": "npm:0.6.7" - "@firebase/performance-compat": "npm:0.2.7" - "@firebase/remote-config": "npm:0.4.7" - "@firebase/remote-config-compat": "npm:0.2.7" - "@firebase/storage": "npm:0.12.5" - "@firebase/storage-compat": "npm:0.3.8" - "@firebase/util": "npm:1.9.6" - "@firebase/vertexai-preview": "npm:0.0.2" - checksum: 10/427d404993a86832ee528a9bb68c12c1f1e81b07b6d61fd721351e64c8ba3025a91d4464361cff9160ca0ef994b2f9d409ecbe0f685430fbe4ce2606822e96d6 + "@firebase/auth": "npm:1.7.5" + "@firebase/auth-compat": "npm:0.5.10" + "@firebase/database": "npm:1.0.6" + "@firebase/database-compat": "npm:1.0.6" + "@firebase/firestore": "npm:4.6.4" + "@firebase/firestore-compat": "npm:0.3.33" + "@firebase/functions": "npm:0.11.6" + "@firebase/functions-compat": "npm:0.3.12" + "@firebase/installations": "npm:0.6.8" + "@firebase/installations-compat": "npm:0.2.8" + "@firebase/messaging": "npm:0.12.10" + "@firebase/messaging-compat": "npm:0.2.10" + "@firebase/performance": "npm:0.6.8" + "@firebase/performance-compat": "npm:0.2.8" + "@firebase/remote-config": "npm:0.4.8" + "@firebase/remote-config-compat": "npm:0.2.8" + "@firebase/storage": "npm:0.12.6" + "@firebase/storage-compat": "npm:0.3.9" + "@firebase/util": "npm:1.9.7" + "@firebase/vertexai-preview": "npm:0.0.3" + checksum: 10/9fd3d72b9c9c0dc9b4fbce1902b06457c847afb426931c3432e9d10fafcdc80c172d86307e5a75864608fbb6e4af13f727b2222a4b9fcb0244fe5b054f1e907d languageName: node linkType: hard @@ -8098,8 +8106,8 @@ __metadata: linkType: hard "glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.7": - version: 10.4.2 - resolution: "glob@npm:10.4.2" + version: 10.4.5 + resolution: "glob@npm:10.4.5" dependencies: foreground-child: "npm:^3.1.0" jackspeak: "npm:^3.1.2" @@ -8109,7 +8117,7 @@ __metadata: path-scurry: "npm:^1.11.1" bin: glob: dist/esm/bin.mjs - checksum: 10/e412776b5952a818eba790c830bea161c9a56813fd767d8c4c49f855603b1fb962b3e73f1f627a47298a57d2992b9f0f2fe15cf93e74ecaaa63fb45d63fdd090 + checksum: 10/698dfe11828b7efd0514cd11e573eaed26b2dff611f0400907281ce3eab0c1e56143ef9b35adc7c77ecc71fba74717b510c7c223d34ca8a98ec81777b293d4ac languageName: node linkType: hard @@ -8429,12 +8437,12 @@ __metadata: linkType: hard "https-proxy-agent@npm:^7.0.1": - version: 7.0.4 - resolution: "https-proxy-agent@npm:7.0.4" + version: 7.0.5 + resolution: "https-proxy-agent@npm:7.0.5" dependencies: agent-base: "npm:^7.0.2" debug: "npm:4" - checksum: 10/405fe582bba461bfe5c7e2f8d752b384036854488b828ae6df6a587c654299cbb2c50df38c4b6ab303502c3c5e029a793fbaac965d1e86ee0be03faceb554d63 + checksum: 10/6679d46159ab3f9a5509ee80c3a3fc83fba3a920a5e18d32176c3327852c3c00ad640c0c4210a8fd70ea3c4a6d3a1b375bf01942516e7df80e2646bdc77658ab languageName: node linkType: hard @@ -8574,6 +8582,13 @@ __metadata: languageName: node linkType: hard +"ini@npm:^4.1.3": + version: 4.1.3 + resolution: "ini@npm:4.1.3" + checksum: 10/f536b414d1442e5b233429e2b56efcdb354109b2d65ddd489e5939d8f0f5ad23c88aa2b19c92987249d0dd63ba8192e9aeb1a02b0459549c5a9ff31acd729a5d + languageName: node + linkType: hard + "internal-slot@npm:^1.0.7": version: 1.0.7 resolution: "internal-slot@npm:1.0.7" @@ -9007,15 +9022,15 @@ __metadata: linkType: hard "jackspeak@npm:^3.1.2": - version: 3.4.0 - resolution: "jackspeak@npm:3.4.0" + version: 3.4.3 + resolution: "jackspeak@npm:3.4.3" dependencies: "@isaacs/cliui": "npm:^8.0.2" "@pkgjs/parseargs": "npm:^0.11.0" dependenciesMeta: "@pkgjs/parseargs": optional: true - checksum: 10/5032c43c0c1fb92e72846ce496df559214253bc6870c90399cbd7858571c53169d9494b7c152df04abcb75f2fb5e9cffe65651c67d573380adf3a482b150d84b + checksum: 10/96f8786eaab98e4bf5b2a5d6d9588ea46c4d06bbc4f2eb861fdd7b6b182b16f71d8a70e79820f335d52653b16d4843b29dd9cdcf38ae80406756db9199497cf3 languageName: node linkType: hard @@ -10045,9 +10060,9 @@ __metadata: linkType: hard "lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": - version: 10.2.2 - resolution: "lru-cache@npm:10.2.2" - checksum: 10/ff1a496d30b5eaec2c9079080965bb0cede203cf878371f7033a007f1e54cd4aa13cc8abf7ccec4c994a83a22ed5476e83a55bb57cc07e6c1547a42937e42c37 + version: 10.4.3 + resolution: "lru-cache@npm:10.4.3" + checksum: 10/e6e90267360476720fa8e83cc168aa2bf0311f3f2eea20a6ba78b90a885ae72071d9db132f40fda4129c803e7dcec3a6b6a6fbb44ca90b081630b810b5d6a41a languageName: node linkType: hard @@ -10381,9 +10396,9 @@ __metadata: linkType: hard "multiformats@npm:^13.1.0": - version: 13.1.1 - resolution: "multiformats@npm:13.1.1" - checksum: 10/5d523145662596c913f292ad54c8fccffe3ff6efc3eddcca3801d2bb64e52702e026b81f9d4f509a8633f1709686c1ef0ebdadbfcc1d540cdbe5f35a46df7cff + version: 13.1.3 + resolution: "multiformats@npm:13.1.3" + checksum: 10/5568213caf73a9cd189afae61b0d8ca4d3175507ee50fa64a8931b7617f4ea9bf076da6fdbe78131151e5d9d48207dcd4ce56863a93d39b3f56d158e2d856daa languageName: node linkType: hard @@ -10507,8 +10522,8 @@ __metadata: linkType: hard "node-gyp@npm:^10.0.0, node-gyp@npm:latest": - version: 10.1.0 - resolution: "node-gyp@npm:10.1.0" + version: 10.2.0 + resolution: "node-gyp@npm:10.2.0" dependencies: env-paths: "npm:^2.2.0" exponential-backoff: "npm:^3.1.1" @@ -10516,13 +10531,13 @@ __metadata: graceful-fs: "npm:^4.2.6" make-fetch-happen: "npm:^13.0.0" nopt: "npm:^7.0.0" - proc-log: "npm:^3.0.0" + proc-log: "npm:^4.1.0" semver: "npm:^7.3.5" - tar: "npm:^6.1.2" + tar: "npm:^6.2.1" which: "npm:^4.0.0" bin: node-gyp: bin/node-gyp.js - checksum: 10/89e105e495e66cd4568af3cf79cdeb67d670eb069e33163c7781d3366470a30367c9bd8dea59e46db16370020139e5bf78b1fbc03284cb571754dfaa59744db5 + checksum: 10/41773093b1275751dec942b985982fd4e7a69b88cae719b868babcef3880ee6168aaec8dcaa8cd0b9fa7c84873e36cc549c6cac6a124ee65ba4ce1f1cc108cfe languageName: node linkType: hard @@ -10552,14 +10567,13 @@ __metadata: linkType: hard "normalize-package-data@npm:^6.0.0": - version: 6.0.1 - resolution: "normalize-package-data@npm:6.0.1" + version: 6.0.2 + resolution: "normalize-package-data@npm:6.0.2" dependencies: hosted-git-info: "npm:^7.0.0" - is-core-module: "npm:^2.8.1" semver: "npm:^7.3.5" validate-npm-package-license: "npm:^3.0.4" - checksum: 10/eb0b1815a105adcba09df26befc35da1dc1c3149784b8ddbcaa90c581925b7a9f1d94aefd344b6020eb0261a5f0575a8a9ef8e92c57eb86182de9a510282c2b2 + checksum: 10/7c4216a2426aa76c0197f8372f06b23a0484d62b3518fb5c0f6ebccb16376bdfab29ceba96f95c75f60506473198f1337fe337b945c8df0541fe32b8049ab4c9 languageName: node linkType: hard @@ -10599,14 +10613,14 @@ __metadata: linkType: hard "npm-pick-manifest@npm:^9.0.0": - version: 9.0.1 - resolution: "npm-pick-manifest@npm:9.0.1" + version: 9.1.0 + resolution: "npm-pick-manifest@npm:9.1.0" dependencies: npm-install-checks: "npm:^6.0.0" npm-normalize-package-bin: "npm:^3.0.0" npm-package-arg: "npm:^11.0.0" semver: "npm:^7.3.5" - checksum: 10/870053b63c8765a5d22df3aabcf09505342dd30398c68e15a57cc32e9da629c361b12285d72bd0bac100786623d2f2dc5ced16270f39dda7c14660fae677590e + checksum: 10/e759e4fe4076da9169cf522964a80bbc096d50cd24c8c44b50b44706c4479bd9d9d018fbdb76c6ea0c6037e012e07c6c917a1ecaa7ae1a1169cddfae1c0f24b6 languageName: node linkType: hard @@ -10639,9 +10653,9 @@ __metadata: linkType: hard "nwsapi@npm:^2.2.0": - version: 2.2.10 - resolution: "nwsapi@npm:2.2.10" - checksum: 10/b310e9dd0886da338cbbb1be9fec473a50269e2935d537f95a03d0038f7ea831ce12b4816d97f42e458e5273158aea2a6c86bc4bb60f79911226154aa66740f7 + version: 2.2.12 + resolution: "nwsapi@npm:2.2.12" + checksum: 10/172119e9ef492467ebfb337f9b5fd12a94d2b519377cde3f6ec2f74a86f6d5c00ef3873539bed7142f908ffca4e35383179be2319d04a563071d146bfa3f1673 languageName: node linkType: hard @@ -11052,13 +11066,13 @@ __metadata: linkType: hard "postcss@npm:^8.4.38": - version: 8.4.38 - resolution: "postcss@npm:8.4.38" + version: 8.4.39 + resolution: "postcss@npm:8.4.39" dependencies: nanoid: "npm:^3.3.7" - picocolors: "npm:^1.0.0" + picocolors: "npm:^1.0.1" source-map-js: "npm:^1.2.0" - checksum: 10/6e44a7ed835ffa9a2b096e8d3e5dfc6bcf331a25c48aeb862dd54e3aaecadf814fa22be224fd308f87d08adf2299164f88c5fd5ab1c4ef6cbd693ceb295377f4 + checksum: 10/ad9c1add892c96433b9a5502878201ede4a20c4ce02d056251f61f8d9a3e5426dab3683fe5a086edfa78a1a19f2b4988c8cea02c5122136d29758cb5a17e2621 languageName: node linkType: hard @@ -11124,14 +11138,7 @@ __metadata: languageName: node linkType: hard -"proc-log@npm:^3.0.0": - version: 3.0.0 - resolution: "proc-log@npm:3.0.0" - checksum: 10/02b64e1b3919e63df06f836b98d3af002b5cd92655cab18b5746e37374bfb73e03b84fe305454614b34c25b485cc687a9eebdccf0242cda8fda2475dd2c97e02 - languageName: node - linkType: hard - -"proc-log@npm:^4.0.0, proc-log@npm:^4.2.0": +"proc-log@npm:^4.0.0, proc-log@npm:^4.1.0, proc-log@npm:^4.2.0": version: 4.2.0 resolution: "proc-log@npm:4.2.0" checksum: 10/4e1394491b717f6c1ade15c570ecd4c2b681698474d3ae2d303c1e4b6ab9455bd5a81566211e82890d5a5ae9859718cc6954d5150bb18b09b72ecb297beae90a @@ -11238,11 +11245,11 @@ __metadata: linkType: hard "qs@npm:^6.11.2": - version: 6.12.1 - resolution: "qs@npm:6.12.1" + version: 6.12.3 + resolution: "qs@npm:6.12.3" dependencies: side-channel: "npm:^1.0.6" - checksum: 10/035bcad2a1ab0175bac7a74c904c15913bdac252834149ccff988c93a51de02642fe7be10e43058ba4dc4094bb28ce9b59d12b9e91d40997f445cfde3ecc1c29 + checksum: 10/486d80cfa5e12886de6fe15a5aa2b3c7023bf4461f949a742022c3ae608499dbaebcb57b1f15c1f59d86356772969028768b33c1a7c01e76d99f149239e63d59 languageName: node linkType: hard @@ -11509,13 +11516,13 @@ __metadata: linkType: hard "rimraf@npm:^5.0.5": - version: 5.0.7 - resolution: "rimraf@npm:5.0.7" + version: 5.0.9 + resolution: "rimraf@npm:5.0.9" dependencies: glob: "npm:^10.3.7" bin: rimraf: dist/esm/bin.mjs - checksum: 10/1e3cecfe59ee2383dfd9ba5373caeed48ed941318a0360119419b7dffc63115661408b9427f67e1f66b5bbb8855a3953db09e55a7362b3df904a44453dfa22fb + checksum: 10/443669809ca3d402ca7565fd9f5b994b5669d8f8b33a23e3a00a66c3a2e4c529d8a5a47c9e7c42f2c7a0c70d21ff8bb1c86493b12027139a3de47fc33fe60084 languageName: node linkType: hard @@ -11550,25 +11557,25 @@ __metadata: linkType: hard "rollup@npm:^4.0.2": - version: 4.18.0 - resolution: "rollup@npm:4.18.0" - dependencies: - "@rollup/rollup-android-arm-eabi": "npm:4.18.0" - "@rollup/rollup-android-arm64": "npm:4.18.0" - "@rollup/rollup-darwin-arm64": "npm:4.18.0" - "@rollup/rollup-darwin-x64": "npm:4.18.0" - "@rollup/rollup-linux-arm-gnueabihf": "npm:4.18.0" - "@rollup/rollup-linux-arm-musleabihf": "npm:4.18.0" - "@rollup/rollup-linux-arm64-gnu": "npm:4.18.0" - "@rollup/rollup-linux-arm64-musl": "npm:4.18.0" - "@rollup/rollup-linux-powerpc64le-gnu": "npm:4.18.0" - "@rollup/rollup-linux-riscv64-gnu": "npm:4.18.0" - "@rollup/rollup-linux-s390x-gnu": "npm:4.18.0" - "@rollup/rollup-linux-x64-gnu": "npm:4.18.0" - "@rollup/rollup-linux-x64-musl": "npm:4.18.0" - "@rollup/rollup-win32-arm64-msvc": "npm:4.18.0" - "@rollup/rollup-win32-ia32-msvc": "npm:4.18.0" - "@rollup/rollup-win32-x64-msvc": "npm:4.18.0" + version: 4.18.1 + resolution: "rollup@npm:4.18.1" + dependencies: + "@rollup/rollup-android-arm-eabi": "npm:4.18.1" + "@rollup/rollup-android-arm64": "npm:4.18.1" + "@rollup/rollup-darwin-arm64": "npm:4.18.1" + "@rollup/rollup-darwin-x64": "npm:4.18.1" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.18.1" + "@rollup/rollup-linux-arm-musleabihf": "npm:4.18.1" + "@rollup/rollup-linux-arm64-gnu": "npm:4.18.1" + "@rollup/rollup-linux-arm64-musl": "npm:4.18.1" + "@rollup/rollup-linux-powerpc64le-gnu": "npm:4.18.1" + "@rollup/rollup-linux-riscv64-gnu": "npm:4.18.1" + "@rollup/rollup-linux-s390x-gnu": "npm:4.18.1" + "@rollup/rollup-linux-x64-gnu": "npm:4.18.1" + "@rollup/rollup-linux-x64-musl": "npm:4.18.1" + "@rollup/rollup-win32-arm64-msvc": "npm:4.18.1" + "@rollup/rollup-win32-ia32-msvc": "npm:4.18.1" + "@rollup/rollup-win32-x64-msvc": "npm:4.18.1" "@types/estree": "npm:1.0.5" fsevents: "npm:~2.3.2" dependenciesMeta: @@ -11608,7 +11615,7 @@ __metadata: optional: true bin: rollup: dist/bin/rollup - checksum: 10/2320fe653cfd5e3d72ecab2f1d52d47e7b624a6ab02919f53c1ad1c5efa3b66e277c3ecfef03bb97651e79cef04bfefd34ad1f6e648f496572bf76c834f19599 + checksum: 10/7a5f110d216e8599dc3cb11cf570316d989abae00785d99c2bcb6027287fe60d2eaed70e457d88a036622e7fc67e8db6e730d3c784aa90a258bd4c020676ad44 languageName: node linkType: hard @@ -11931,17 +11938,17 @@ __metadata: linkType: hard "socks-proxy-agent@npm:^8.0.3": - version: 8.0.3 - resolution: "socks-proxy-agent@npm:8.0.3" + version: 8.0.4 + resolution: "socks-proxy-agent@npm:8.0.4" dependencies: agent-base: "npm:^7.1.1" debug: "npm:^4.3.4" - socks: "npm:^2.7.1" - checksum: 10/c2112c66d6322e497d68e913c3780f3683237fd394bfd480b9283486a86e36095d0020db96145d88f8ccd9cc73261b98165b461f9c1bf5dc17abfe75c18029ce + socks: "npm:^2.8.3" + checksum: 10/c8e7c2b398338b49a0a0f4d2bae5c0602aeeca6b478b99415927b6c5db349ca258448f2c87c6958ebf83eea17d42cbc5d1af0bfecb276cac10b9658b0f07f7d7 languageName: node linkType: hard -"socks@npm:^2.7.1": +"socks@npm:^2.8.3": version: 2.8.3 resolution: "socks@npm:2.8.3" dependencies: @@ -12360,7 +12367,7 @@ __metadata: languageName: node linkType: hard -"tar@npm:^6.1.11, tar@npm:^6.1.2": +"tar@npm:^6.1.11, tar@npm:^6.2.1": version: 6.2.1 resolution: "tar@npm:6.2.1" dependencies: @@ -12406,11 +12413,11 @@ __metadata: linkType: hard "text-decoder@npm:^1.1.0": - version: 1.1.0 - resolution: "text-decoder@npm:1.1.0" + version: 1.1.1 + resolution: "text-decoder@npm:1.1.1" dependencies: b4a: "npm:^1.6.4" - checksum: 10/4c0c9997a59f5531e604d80f0e5a8a2206e25adc11bdd090d0a01190467134383dfe27d13c834b31966e411a358c6bf8c97e96098573a7080a2e205fa49fd050 + checksum: 10/c6981b93850daeafc8bd1dbd8f984d4fb2d14632f450de0892692b5bbee2d2f4cbef8a807142527370649fd357f58491ede4915d43669eca624cb52b8dd247b6 languageName: node linkType: hard @@ -12767,9 +12774,9 @@ __metadata: linkType: hard "type-fest@npm:^4.0.0": - version: 4.20.1 - resolution: "type-fest@npm:4.20.1" - checksum: 10/52dc64fae094949008afb79f21b02eca0289c8dc41ed1cfff88f343230edb476fca4815e1b5d58acf5e07fdc7a1b098504473b5931ef418e6f38a3edb70fc1df + version: 4.21.0 + resolution: "type-fest@npm:4.21.0" + checksum: 10/a4dc074b25239fff4062495c58554dcec15845622d753092d2bf24fc3b1c49f85805ed74f151976d666056ff122b3a5a988e85226575b7fbbc8e92d2db210137 languageName: node linkType: hard @@ -12939,9 +12946,9 @@ __metadata: languageName: node linkType: hard -"update-browserslist-db@npm:^1.0.16": - version: 1.0.16 - resolution: "update-browserslist-db@npm:1.0.16" +"update-browserslist-db@npm:^1.1.0": + version: 1.1.0 + resolution: "update-browserslist-db@npm:1.1.0" dependencies: escalade: "npm:^3.1.2" picocolors: "npm:^1.0.1" @@ -12949,7 +12956,7 @@ __metadata: browserslist: ">= 4.21.0" bin: update-browserslist-db: cli.js - checksum: 10/071bf0b2fb8568db6cd42ee2598ac9b87c794a7229fcbf1b035ae7f883e770c07143f16a5371525d5bcb94b99f9a1b279036142b0195ffd4cf5a0008fc4a500e + checksum: 10/d70b9efeaf4601aadb1a4f6456a7a5d9118e0063d995866b8e0c5e0cf559482671dab6ce7b079f9536b06758a344fbd83f974b965211e1c6e8d1958540b0c24c languageName: node linkType: hard @@ -13539,8 +13546,8 @@ __metadata: linkType: hard "yocto-queue@npm:^1.0.0": - version: 1.0.0 - resolution: "yocto-queue@npm:1.0.0" - checksum: 10/2cac84540f65c64ccc1683c267edce396b26b1e931aa429660aefac8fbe0188167b7aee815a3c22fa59a28a58d898d1a2b1825048f834d8d629f4c2a5d443801 + version: 1.1.1 + resolution: "yocto-queue@npm:1.1.1" + checksum: 10/f2e05b767ed3141e6372a80af9caa4715d60969227f38b1a4370d60bffe153c9c5b33a862905609afc9b375ec57cd40999810d20e5e10229a204e8bde7ef255c languageName: node linkType: hard From 27ba6c5c8ccfcad6cbec51b4a3dd602d90bf7162 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 17 Jul 2024 13:07:34 -0400 Subject: [PATCH 44/47] Bump `@metamask/keyring-api` from `^8.0.0` to `^8.0.1` --- package.json | 1 - packages/accounts-controller/package.json | 2 +- .../src/AccountsController.ts | 1 + packages/assets-controllers/package.json | 2 +- packages/chain-controller/package.json | 2 +- packages/keyring-controller/package.json | 2 +- packages/transaction-controller/package.json | 2 +- yarn.lock | 38 +++++++++++++------ 8 files changed, 33 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 815fdaa2aa..8f702f47fd 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/keyring-api": "github:MetaMask/keyring-api#replace-superstruct-with-fork", "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 67a5cb3847..a07ee20bc3 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -44,7 +44,7 @@ "@ethereumjs/util": "^8.1.0", "@metamask/base-controller": "^6.0.1", "@metamask/eth-snap-keyring": "^4.3.1", - "@metamask/keyring-api": "^8.0.0", + "@metamask/keyring-api": "^8.0.1", "@metamask/keyring-controller": "^17.1.1", "@metamask/snaps-sdk": "^6.0.0", "@metamask/snaps-utils": "^7.7.0", diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index dde5f31a11..9148b8c513 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -423,6 +423,7 @@ export class AccountsController extends BaseController< ...account, metadata: { ...account.metadata, name: accountName }, }; + // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types currentState.internalAccounts.accounts[accountId] = internalAccount; }); } diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index 3fbc7dc82f..94a6f5befb 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -74,7 +74,7 @@ "devDependencies": { "@metamask/auto-changelog": "^3.4.4", "@metamask/ethjs-provider-http": "^0.3.0", - "@metamask/keyring-api": "^8.0.0", + "@metamask/keyring-api": "^8.0.1", "@types/jest": "^27.4.1", "@types/lodash": "^4.14.191", "@types/node": "^16.18.54", diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 1c84087753..d1d83a9cd4 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -43,7 +43,7 @@ "dependencies": { "@metamask/base-controller": "^6.0.1", "@metamask/chain-api": "^0.1.0", - "@metamask/keyring-api": "^8.0.0", + "@metamask/keyring-api": "^8.0.1", "@metamask/snaps-controllers": "^8.1.1", "@metamask/snaps-sdk": "^6.0.0", "@metamask/snaps-utils": "^7.7.0", diff --git a/packages/keyring-controller/package.json b/packages/keyring-controller/package.json index e6f263d8d4..e368b7bbad 100644 --- a/packages/keyring-controller/package.json +++ b/packages/keyring-controller/package.json @@ -48,7 +48,7 @@ "@metamask/eth-hd-keyring": "^7.0.1", "@metamask/eth-sig-util": "^7.0.1", "@metamask/eth-simple-keyring": "^6.0.1", - "@metamask/keyring-api": "^8.0.0", + "@metamask/keyring-api": "^8.0.1", "@metamask/message-manager": "^10.0.1", "@metamask/utils": "^9.0.0", "async-mutex": "^0.5.0", diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index d621c022d9..20b502f085 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -70,7 +70,7 @@ "@metamask/auto-changelog": "^3.4.4", "@metamask/eth-json-rpc-provider": "^4.1.1", "@metamask/ethjs-provider-http": "^0.3.0", - "@metamask/keyring-api": "^8.0.0", + "@metamask/keyring-api": "^8.0.1", "@types/bn.js": "^5.1.5", "@types/jest": "^27.4.1", "@types/node": "^16.18.54", diff --git a/yarn.lock b/yarn.lock index 34ae0e4766..cd92049cfe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2201,7 +2201,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.1" "@metamask/eth-snap-keyring": "npm:^4.3.1" - "@metamask/keyring-api": "npm:^8.0.0" + "@metamask/keyring-api": "npm:^8.0.1" "@metamask/keyring-controller": "npm:^17.1.1" "@metamask/snaps-controllers": "npm:^8.1.1" "@metamask/snaps-sdk": "npm:^6.0.0" @@ -2319,7 +2319,7 @@ __metadata: "@metamask/controller-utils": "npm:^11.0.1" "@metamask/eth-query": "npm:^4.0.0" "@metamask/ethjs-provider-http": "npm:^0.3.0" - "@metamask/keyring-api": "npm:^8.0.0" + "@metamask/keyring-api": "npm:^8.0.1" "@metamask/keyring-controller": "npm:^17.1.1" "@metamask/metamask-eth-abis": "npm:^3.1.1" "@metamask/network-controller": "npm:^20.0.0" @@ -2461,7 +2461,7 @@ __metadata: "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.1" "@metamask/chain-api": "npm:^0.1.0" - "@metamask/keyring-api": "npm:^8.0.0" + "@metamask/keyring-api": "npm:^8.0.1" "@metamask/snaps-controllers": "npm:^8.1.1" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/snaps-utils": "npm:^7.7.0" @@ -3112,20 +3112,19 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-api@github:MetaMask/keyring-api#replace-superstruct-with-fork": - version: 8.0.0 - resolution: "@metamask/keyring-api@https://github.com/MetaMask/keyring-api.git#commit=3dcfc81f99360d7920e1c52625599ee8d2d1a55e" +"@metamask/keyring-api@npm:^8.0.0, @metamask/keyring-api@npm:^8.0.1": + version: 8.0.1 + resolution: "@metamask/keyring-api@npm:8.0.1" dependencies: - "@metamask/providers": "npm:17.0.0" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^9.0.0" + "@metamask/utils": "npm:^9.1.0" "@types/uuid": "npm:^9.0.8" bech32: "npm:^2.0.0" uuid: "npm:^9.0.1" peerDependencies: "@metamask/providers": ">=15 <18" - checksum: 10/00dfcadaab242b790537b8928a436cedb0c2da860f7ff45d13079adaf73126bd5f208a4d173a1b7077a83c27dc259281a44e2770255cb197c231b7eb49280e2c + checksum: 10/a54d78130a71b51eebcaff1aaf35e5f7c56e6032850453c155ef2085df541a8b4b231106aaf481d049ec0f95da9faca04ead56944b71b4602916e6cacdd96c7f languageName: node linkType: hard @@ -3145,7 +3144,7 @@ __metadata: "@metamask/eth-hd-keyring": "npm:^7.0.1" "@metamask/eth-sig-util": "npm:^7.0.1" "@metamask/eth-simple-keyring": "npm:^6.0.1" - "@metamask/keyring-api": "npm:^8.0.0" + "@metamask/keyring-api": "npm:^8.0.1" "@metamask/message-manager": "npm:^10.0.1" "@metamask/scure-bip39": "npm:^2.1.1" "@metamask/utils": "npm:^9.0.0" @@ -3851,7 +3850,7 @@ __metadata: "@metamask/eth-query": "npm:^4.0.0" "@metamask/ethjs-provider-http": "npm:^0.3.0" "@metamask/gas-fee-controller": "npm:^19.0.0" - "@metamask/keyring-api": "npm:^8.0.0" + "@metamask/keyring-api": "npm:^8.0.1" "@metamask/metamask-eth-abis": "npm:^3.1.1" "@metamask/network-controller": "npm:^20.0.0" "@metamask/nonce-tracker": "npm:^5.0.0" @@ -3955,6 +3954,23 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^9.1.0": + version: 9.1.0 + resolution: "@metamask/utils@npm:9.1.0" + dependencies: + "@ethereumjs/tx": "npm:^4.2.0" + "@metamask/superstruct": "npm:^3.1.0" + "@noble/hashes": "npm:^1.3.1" + "@scure/base": "npm:^1.1.3" + "@types/debug": "npm:^4.1.7" + debug: "npm:^4.3.4" + pony-cause: "npm:^2.1.10" + semver: "npm:^7.5.4" + uuid: "npm:^9.0.1" + checksum: 10/7335e151a51be92e86868dc48b3ee78c376d4edd5d758d334176027247637ab22839d8f663bd02542c0a19b05ecec456bedab5f36436689cf3d953ca36d91781 + languageName: node + linkType: hard + "@ngraveio/bc-ur@npm:^1.1.5": version: 1.1.13 resolution: "@ngraveio/bc-ur@npm:1.1.13" From 09b29caa39d1f14c0e57cf15bf4597c83b1d4cb6 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 17 Jul 2024 13:46:49 -0400 Subject: [PATCH 45/47] Update yarn resolutions for `snaps-{sdk,utils}` --- package.json | 4 +- .../src/AccountsController.ts | 3 +- yarn.lock | 38 +++++-------------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 4afa42ce1f..195da6c908 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", - "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6", + "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=3c95d8b54a7778d0473499826688cefa5d0b7012", + "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=3c95d8b54a7778d0473499826688cefa5d0b7012", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index 9148b8c513..560623095d 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -423,7 +423,8 @@ export class AccountsController extends BaseController< ...account, metadata: { ...account.metadata, name: accountName }, }; - // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types + // Error is flaky. Leaving commented `ts-expect-error` directive so it can be re-enabled if needed. + // // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types currentState.internalAccounts.accounts[accountId] = internalAccount; }); } diff --git a/yarn.lock b/yarn.lock index 1f05d0f53a..d5a82ea25c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3772,22 +3772,22 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6": +"@metamask/snaps-sdk@github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=3c95d8b54a7778d0473499826688cefa5d0b7012": version: 6.0.0 - resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-sdk&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6" + resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-sdk&commit=3c95d8b54a7778d0473499826688cefa5d0b7012" dependencies: "@metamask/key-tree": "npm:^9.1.2" "@metamask/providers": "npm:17.0.0" "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^9.0.0" - checksum: 10/aba1cec053caf1a460bf143fa340f4722f97dbcf325bef7e0203cd0823b4411ab2da0bf945d54293a89cd3847d40057f2a524324e8d15897cfaf59b7b6acbe12 + "@metamask/utils": "npm:^9.1.0" + checksum: 10/8a5ef3e62935150f0e2c4e17a87baf9f90779ea3fd530b8ae81cfb5c67bbfbeae6dc9c390dd208d950f421dec4f98732d8b391f3b5fa330377db8eda69d83659 languageName: node linkType: hard -"@metamask/snaps-utils@github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6": +"@metamask/snaps-utils@github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=3c95d8b54a7778d0473499826688cefa5d0b7012": version: 7.7.0 - resolution: "@metamask/snaps-utils@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-utils&commit=485c9699ddb0109068d7a07ecdd3539e510c8df6" + resolution: "@metamask/snaps-utils@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-utils&commit=3c95d8b54a7778d0473499826688cefa5d0b7012" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" @@ -3799,7 +3799,7 @@ __metadata: "@metamask/snaps-registry": "npm:^3.2.1" "@metamask/snaps-sdk": "npm:^6.0.0" "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^9.0.0" + "@metamask/utils": "npm:^9.1.0" "@noble/hashes": "npm:^1.3.1" "@scure/base": "npm:^1.1.1" chalk: "npm:^4.1.2" @@ -3812,7 +3812,7 @@ __metadata: semver: "npm:^7.5.4" ses: "npm:^1.1.0" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/27e70d9c0450ae93ef6268fc26d62054bbd1c61b05d1237c5e888177956652aabca290f49ec7de34421dd311d6ed41691cdf9b611b6d28cbc17dffa672f89307 + checksum: 10/73c2a2f41c91d4dd56a7bad48c3e95c80557f44742a4c2731c945f1ccb30dad4260f733cf2a8fbc6c643085499ac71ee3ec4af334944dc16819f844577cc9cda languageName: node linkType: hard @@ -3985,7 +3985,7 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.4.2, @noble/curves@npm:~1.4.0": +"@noble/curves@npm:1.4.2, @noble/curves@npm:^1.2.0, @noble/curves@npm:~1.4.0": version: 1.4.2 resolution: "@noble/curves@npm:1.4.2" dependencies: @@ -3994,15 +3994,6 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:^1.2.0": - version: 1.4.0 - resolution: "@noble/curves@npm:1.4.0" - dependencies: - "@noble/hashes": "npm:1.4.0" - checksum: 10/b21b30a36ff02bfcc0f5e6163d245cdbaf7f640511fff97ccf83fc207ee79cfd91584b4d97977374de04cb118a55eb63a7964c82596a64162bbc42bc685ae6d9 - languageName: node - linkType: hard - "@noble/hashes@npm:1.3.2": version: 1.3.2 resolution: "@noble/hashes@npm:1.3.2" @@ -5102,7 +5093,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.11.0": +"acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": version: 8.12.1 resolution: "acorn@npm:8.12.1" bin: @@ -5111,15 +5102,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10/b688e7e3c64d9bfb17b596e1b35e4da9d50553713b3b3630cf5690f2b023a84eac90c56851e6912b483fe60e8b4ea28b254c07e92f17ef83d72d78745a8352dd - languageName: node - linkType: hard - "aes-js@npm:4.0.0-beta.5": version: 4.0.0-beta.5 resolution: "aes-js@npm:4.0.0-beta.5" From 59fe39433f4c1945de7f7413d861e0918376df95 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 19 Jul 2024 13:02:17 -0400 Subject: [PATCH 46/47] Bump `@metamask/snaps-sdk` to `^6.1.0`, `@metamask/snaps-utils` to `^7.8.0`, `@metamask/snaps-controllers` to `^9.3.0` --- package.json | 2 - packages/accounts-controller/package.json | 8 +- .../src/AccountsController.ts | 4 +- packages/chain-controller/package.json | 6 +- packages/profile-sync-controller/package.json | 8 +- yarn.lock | 173 ++++++++++++++---- 6 files changed, 149 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 195da6c908..98426374cc 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,6 @@ "pre-push": "yarn lint" }, "resolutions": { - "@metamask/snaps-sdk": "github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=3c95d8b54a7778d0473499826688cefa5d0b7012", - "@metamask/snaps-utils": "github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=3c95d8b54a7778d0473499826688cefa5d0b7012", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 363deb2f7d..7056429297 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -46,8 +46,8 @@ "@metamask/eth-snap-keyring": "^4.3.1", "@metamask/keyring-api": "^8.0.1", "@metamask/keyring-controller": "^17.1.1", - "@metamask/snaps-sdk": "^6.0.0", - "@metamask/snaps-utils": "^7.7.0", + "@metamask/snaps-sdk": "^6.1.0", + "@metamask/snaps-utils": "^7.8.0", "@metamask/utils": "^9.1.0", "deepmerge": "^4.2.2", "ethereum-cryptography": "^2.1.2", @@ -56,7 +56,7 @@ }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", - "@metamask/snaps-controllers": "^8.1.1", + "@metamask/snaps-controllers": "^9.3.0", "@types/jest": "^27.4.1", "@types/readable-stream": "^2.3.0", "jest": "^27.5.1", @@ -67,7 +67,7 @@ }, "peerDependencies": { "@metamask/keyring-controller": "^17.0.0", - "@metamask/snaps-controllers": "^8.1.1" + "@metamask/snaps-controllers": "^9.3.0" }, "engines": { "node": "^18.18 || >=20" diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index 560623095d..77d8a55ad8 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -423,8 +423,8 @@ export class AccountsController extends BaseController< ...account, metadata: { ...account.metadata, name: accountName }, }; - // Error is flaky. Leaving commented `ts-expect-error` directive so it can be re-enabled if needed. - // // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types + // Do not remove this comment: This error is flaky. Comment out and restore the `ts-expect-error` directive below as needed. + // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types currentState.internalAccounts.accounts[accountId] = internalAccount; }); } diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 6b74b97afd..95e10fe579 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -44,9 +44,9 @@ "@metamask/base-controller": "^6.0.1", "@metamask/chain-api": "^0.1.0", "@metamask/keyring-api": "^8.0.1", - "@metamask/snaps-controllers": "^8.1.1", - "@metamask/snaps-sdk": "^6.0.0", - "@metamask/snaps-utils": "^7.7.0", + "@metamask/snaps-controllers": "^9.3.0", + "@metamask/snaps-sdk": "^6.1.0", + "@metamask/snaps-utils": "^7.8.0", "@metamask/utils": "^9.1.0", "uuid": "^8.3.2" }, diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index d35f3625d9..65651db116 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -42,9 +42,9 @@ }, "dependencies": { "@metamask/base-controller": "^6.0.1", - "@metamask/snaps-controllers": "^8.1.1", - "@metamask/snaps-sdk": "^6.0.0", - "@metamask/snaps-utils": "^7.7.0", + "@metamask/snaps-controllers": "^9.3.0", + "@metamask/snaps-sdk": "^6.1.0", + "@metamask/snaps-utils": "^7.8.0", "@noble/ciphers": "^0.5.2", "@noble/hashes": "^1.4.0", "immer": "^9.0.6", @@ -66,7 +66,7 @@ "typescript": "~5.0.4" }, "peerDependencies": { - "@metamask/snaps-controllers": "^8.1.1" + "@metamask/snaps-controllers": "^9.3.0" }, "engines": { "node": "^18.18 || >=20" diff --git a/yarn.lock b/yarn.lock index d5a82ea25c..e8ca65f1de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2203,9 +2203,9 @@ __metadata: "@metamask/eth-snap-keyring": "npm:^4.3.1" "@metamask/keyring-api": "npm:^8.0.1" "@metamask/keyring-controller": "npm:^17.1.1" - "@metamask/snaps-controllers": "npm:^8.1.1" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" + "@metamask/snaps-controllers": "npm:^9.3.0" + "@metamask/snaps-sdk": "npm:^6.1.0" + "@metamask/snaps-utils": "npm:^7.8.0" "@metamask/utils": "npm:^9.1.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" @@ -2220,7 +2220,7 @@ __metadata: uuid: "npm:^8.3.2" peerDependencies: "@metamask/keyring-controller": ^17.0.0 - "@metamask/snaps-controllers": ^8.1.1 + "@metamask/snaps-controllers": ^9.3.0 languageName: unknown linkType: soft @@ -2281,7 +2281,7 @@ __metadata: languageName: node linkType: hard -"@metamask/approval-controller@npm:^7.0.1, @metamask/approval-controller@workspace:packages/approval-controller": +"@metamask/approval-controller@npm:^7.0.0, @metamask/approval-controller@npm:^7.0.1, @metamask/approval-controller@workspace:packages/approval-controller": version: 0.0.0-use.local resolution: "@metamask/approval-controller@workspace:packages/approval-controller" dependencies: @@ -2462,9 +2462,9 @@ __metadata: "@metamask/base-controller": "npm:^6.0.1" "@metamask/chain-api": "npm:^0.1.0" "@metamask/keyring-api": "npm:^8.0.1" - "@metamask/snaps-controllers": "npm:^8.1.1" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" + "@metamask/snaps-controllers": "npm:^9.3.0" + "@metamask/snaps-sdk": "npm:^6.1.0" + "@metamask/snaps-utils": "npm:^7.8.0" "@metamask/utils": "npm:^9.1.0" "@types/jest": "npm:^27.4.1" "@types/readable-stream": "npm:^2.3.0" @@ -3045,7 +3045,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^9.0.1, @metamask/json-rpc-engine@workspace:packages/json-rpc-engine": +"@metamask/json-rpc-engine@npm:^9.0.0, @metamask/json-rpc-engine@npm:^9.0.1, @metamask/json-rpc-engine@workspace:packages/json-rpc-engine": version: 0.0.0-use.local resolution: "@metamask/json-rpc-engine@workspace:packages/json-rpc-engine" dependencies: @@ -3076,7 +3076,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": +"@metamask/json-rpc-middleware-stream@npm:^8.0.0, @metamask/json-rpc-middleware-stream@npm:^8.0.1, @metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": version: 0.0.0-use.local resolution: "@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream" dependencies: @@ -3426,20 +3426,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/phishing-controller@npm:^9.0.1": - version: 9.0.4 - resolution: "@metamask/phishing-controller@npm:9.0.4" - dependencies: - "@metamask/base-controller": "npm:^5.0.2" - "@metamask/controller-utils": "npm:^10.0.0" - "@types/punycode": "npm:^2.1.0" - eth-phishing-detect: "npm:^1.2.0" - punycode: "npm:^2.1.1" - checksum: 10/e68258c3dfedd7a60a040f8b58577ee98cc4566a3893a047b7b620edd72e98c8f2f75056332457b9773932c3ae8cbc7c66bbe0792e07de31dff895a9b77d081b - languageName: node - linkType: hard - -"@metamask/phishing-controller@workspace:packages/phishing-controller": +"@metamask/phishing-controller@npm:^10.0.0, @metamask/phishing-controller@workspace:packages/phishing-controller": version: 0.0.0-use.local resolution: "@metamask/phishing-controller@workspace:packages/phishing-controller" dependencies: @@ -3462,6 +3449,19 @@ __metadata: languageName: unknown linkType: soft +"@metamask/phishing-controller@npm:^9.0.1": + version: 9.0.4 + resolution: "@metamask/phishing-controller@npm:9.0.4" + dependencies: + "@metamask/base-controller": "npm:^5.0.2" + "@metamask/controller-utils": "npm:^10.0.0" + "@types/punycode": "npm:^2.1.0" + eth-phishing-detect: "npm:^1.2.0" + punycode: "npm:^2.1.1" + checksum: 10/e68258c3dfedd7a60a040f8b58577ee98cc4566a3893a047b7b620edd72e98c8f2f75056332457b9773932c3ae8cbc7c66bbe0792e07de31dff895a9b77d081b + languageName: node + linkType: hard + "@metamask/polling-controller@npm:^9.0.0, @metamask/polling-controller@workspace:packages/polling-controller": version: 0.0.0-use.local resolution: "@metamask/polling-controller@workspace:packages/polling-controller" @@ -3525,9 +3525,9 @@ __metadata: "@lavamoat/allow-scripts": "npm:^3.0.4" "@metamask/auto-changelog": "npm:^3.4.4" "@metamask/base-controller": "npm:^6.0.1" - "@metamask/snaps-controllers": "npm:^8.1.1" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" + "@metamask/snaps-controllers": "npm:^9.3.0" + "@metamask/snaps-sdk": "npm:^6.1.0" + "@metamask/snaps-utils": "npm:^7.8.0" "@noble/ciphers": "npm:^0.5.2" "@noble/hashes": "npm:^1.4.0" "@types/jest": "npm:^27.4.1" @@ -3544,7 +3544,7 @@ __metadata: typedoc-plugin-missing-exports: "npm:^2.0.0" typescript: "npm:~5.0.4" peerDependencies: - "@metamask/snaps-controllers": ^8.1.1 + "@metamask/snaps-controllers": ^9.3.0 languageName: unknown linkType: soft @@ -3569,6 +3569,27 @@ __metadata: languageName: node linkType: hard +"@metamask/providers@npm:^17.0.0": + version: 17.1.1 + resolution: "@metamask/providers@npm:17.1.1" + dependencies: + "@metamask/json-rpc-engine": "npm:^9.0.1" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.1" + "@metamask/object-multiplex": "npm:^2.0.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/safe-event-emitter": "npm:^3.1.1" + "@metamask/utils": "npm:^9.0.0" + detect-browser: "npm:^5.2.0" + extension-port-stream: "npm:^4.1.0" + fast-deep-equal: "npm:^3.1.3" + is-stream: "npm:^2.0.0" + readable-stream: "npm:^3.6.2" + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/9aed27c02ce97838705b3dacc4f2d8a821586e5aef2e98315f98e5be1a457ac5d48602fd7d5bdc4ac608e18cca13c723b685c3d03820b952f036647eac0121ce + languageName: node + linkType: hard + "@metamask/queued-request-controller@workspace:packages/queued-request-controller": version: 0.0.0-use.local resolution: "@metamask/queued-request-controller@workspace:packages/queued-request-controller" @@ -3744,6 +3765,43 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-controllers@npm:^9.3.0": + version: 9.3.0 + resolution: "@metamask/snaps-controllers@npm:9.3.0" + dependencies: + "@metamask/approval-controller": "npm:^7.0.0" + "@metamask/base-controller": "npm:^6.0.1" + "@metamask/json-rpc-engine": "npm:^9.0.0" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.0" + "@metamask/object-multiplex": "npm:^2.0.0" + "@metamask/permission-controller": "npm:^10.0.1" + "@metamask/phishing-controller": "npm:^10.0.0" + "@metamask/post-message-stream": "npm:^8.1.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/snaps-registry": "npm:^3.2.1" + "@metamask/snaps-rpc-methods": "npm:^10.0.0" + "@metamask/snaps-sdk": "npm:^6.1.0" + "@metamask/snaps-utils": "npm:^7.8.0" + "@metamask/utils": "npm:^9.1.0" + "@xstate/fsm": "npm:^2.0.0" + browserify-zlib: "npm:^0.2.0" + concat-stream: "npm:^2.0.0" + fast-deep-equal: "npm:^3.1.3" + get-npm-tarball-url: "npm:^2.0.3" + immer: "npm:^9.0.6" + nanoid: "npm:^3.1.31" + readable-stream: "npm:^3.6.2" + readable-web-to-node-stream: "npm:^3.0.2" + tar-stream: "npm:^3.1.7" + peerDependencies: + "@metamask/snaps-execution-environments": ^6.6.1 + peerDependenciesMeta: + "@metamask/snaps-execution-environments": + optional: true + checksum: 10/065e7a3e5242f1693ade7c89acdbbf16e2f4caa395ca924c4378e8e66fdcf52212e30292ace0683e3ebb5816eef35d762df49b9abffba25d9cf0e93899d6a1fb + languageName: node + linkType: hard + "@metamask/snaps-registry@npm:^3.1.0, @metamask/snaps-registry@npm:^3.2.1": version: 3.2.1 resolution: "@metamask/snaps-registry@npm:3.2.1" @@ -3756,6 +3814,22 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-rpc-methods@npm:^10.0.0": + version: 10.0.0 + resolution: "@metamask/snaps-rpc-methods@npm:10.0.0" + dependencies: + "@metamask/key-tree": "npm:^9.1.2" + "@metamask/permission-controller": "npm:^10.0.1" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/snaps-sdk": "npm:^6.1.0" + "@metamask/snaps-utils": "npm:^7.8.0" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.1.0" + "@noble/hashes": "npm:^1.3.1" + checksum: 10/a471d224c1cf88aeff5245f61df40402839e4e027c4495cd2833c703fe7a3b2f1a1ddd20e89455e1842c8f32db65e0a35343463bad622ebe06e7138b52d7a6a5 + languageName: node + linkType: hard + "@metamask/snaps-rpc-methods@npm:^9.1.2": version: 9.1.4 resolution: "@metamask/snaps-rpc-methods@npm:9.1.4" @@ -3772,22 +3846,36 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-sdk@github:MetaMask/snaps#workspace=@metamask/snaps-sdk&commit=3c95d8b54a7778d0473499826688cefa5d0b7012": - version: 6.0.0 - resolution: "@metamask/snaps-sdk@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-sdk&commit=3c95d8b54a7778d0473499826688cefa5d0b7012" +"@metamask/snaps-sdk@npm:^4.2.0, @metamask/snaps-sdk@npm:^4.4.2": + version: 4.4.2 + resolution: "@metamask/snaps-sdk@npm:4.4.2" + dependencies: + "@metamask/key-tree": "npm:^9.1.1" + "@metamask/providers": "npm:^17.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/utils": "npm:^8.3.0" + fast-xml-parser: "npm:^4.3.4" + superstruct: "npm:^1.0.3" + checksum: 10/32be48679eb306ec97c2ee16b4146ce69875e665feb61c04f7e63a23361c445b49ad4a0c8f6176560e7973b09c56e5a26055ba7cd894d67111c8c3cedf90dc4f + languageName: node + linkType: hard + +"@metamask/snaps-sdk@npm:^6.0.0, @metamask/snaps-sdk@npm:^6.1.0": + version: 6.1.0 + resolution: "@metamask/snaps-sdk@npm:6.1.0" dependencies: "@metamask/key-tree": "npm:^9.1.2" "@metamask/providers": "npm:17.0.0" "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^9.1.0" - checksum: 10/8a5ef3e62935150f0e2c4e17a87baf9f90779ea3fd530b8ae81cfb5c67bbfbeae6dc9c390dd208d950f421dec4f98732d8b391f3b5fa330377db8eda69d83659 + checksum: 10/1cdad5356872dea44313914ed446cddd9bcaf397b60b47e1d93a11cacb6974066f60ca55cfa3c8fe74d7852188113994433401647fa02e13d1e9f0bd8dfde013 languageName: node linkType: hard -"@metamask/snaps-utils@github:MetaMask/snaps#workspace=@metamask/snaps-utils&commit=3c95d8b54a7778d0473499826688cefa5d0b7012": - version: 7.7.0 - resolution: "@metamask/snaps-utils@https://github.com/MetaMask/snaps.git#workspace=%40metamask%2Fsnaps-utils&commit=3c95d8b54a7778d0473499826688cefa5d0b7012" +"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.5.0, @metamask/snaps-utils@npm:^7.7.0, @metamask/snaps-utils@npm:^7.8.0": + version: 7.8.0 + resolution: "@metamask/snaps-utils@npm:7.8.0" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" @@ -3797,7 +3885,7 @@ __metadata: "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/slip44": "npm:^3.1.0" "@metamask/snaps-registry": "npm:^3.2.1" - "@metamask/snaps-sdk": "npm:^6.0.0" + "@metamask/snaps-sdk": "npm:^6.1.0" "@metamask/superstruct": "npm:^3.1.0" "@metamask/utils": "npm:^9.1.0" "@noble/hashes": "npm:^1.3.1" @@ -3812,7 +3900,7 @@ __metadata: semver: "npm:^7.5.4" ses: "npm:^1.1.0" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/73c2a2f41c91d4dd56a7bad48c3e95c80557f44742a4c2731c945f1ccb30dad4260f733cf2a8fbc6c643085499ac71ee3ec4af334944dc16819f844577cc9cda + checksum: 10/e4629fe57f6cbc9ba2a7ac3b41cc919c83574b8d6c9e71b593fbc5b37d6f15a7d46498dade56dbf61268a898f33b53f48cba7207c9bb5e7b6a9c79cc3cfc9aaa languageName: node linkType: hard @@ -7634,6 +7722,17 @@ __metadata: languageName: node linkType: hard +"extension-port-stream@npm:^4.1.0": + version: 4.2.0 + resolution: "extension-port-stream@npm:4.2.0" + dependencies: + readable-stream: "npm:^3.6.2 || ^4.4.2" + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/85559c82e3f3aa21462e234b30b7d53872708893664cd03f2f848af556cf0730cf2243b089efc9d40bbe9a4f73bd8fd19684db5a985329b0c4402b4f2fe26358 + languageName: node + linkType: hard + "fast-copy@npm:^2.1.7": version: 2.1.7 resolution: "fast-copy@npm:2.1.7" From f50b209ebfe5cad622fb8cd4d1096edb0d11715c Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 19 Jul 2024 14:03:24 -0400 Subject: [PATCH 47/47] Set yarn resolution for `@metamask/snaps-sdk@6.1.0` dependency `@metamask/providers` from `17.0.0` to `17.1.1` --- package.json | 1 + packages/accounts-controller/CHANGELOG.md | 7 ++++++ .../src/AccountsController.ts | 4 ++-- packages/chain-controller/CHANGELOG.md | 7 ++++++ packages/profile-sync-controller/CHANGELOG.md | 7 ++++++ yarn.lock | 23 +------------------ 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index fadb540dbc..d18e80d83c 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "pre-push": "yarn lint" }, "resolutions": { + "@metamask/snaps-sdk@6.1.0/@metamask/providers": "17.1.1", "tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch" }, "devDependencies": { diff --git a/packages/accounts-controller/CHANGELOG.md b/packages/accounts-controller/CHANGELOG.md index bb3606bd4b..bec467408e 100644 --- a/packages/accounts-controller/CHANGELOG.md +++ b/packages/accounts-controller/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Uncategorized + +- Please hold off on new releases of this package until the yarn resolution for `@metamask/providers` is removed. + - This is blocked by a `@metamask/snaps-sdk` release with `@metamask/providers` bumped to `>=17.1.1`. + - See: [Fix regressions introduced by @metamask/providers@17.1.1](https://github.com/MetaMask/snaps/pull/2579) + - Build error fixed by yarn resolution: [MetaMask/core/actions/runs/10011688901/job/27675682526?pr=3645](https://github.com/MetaMask/core/actions/runs/10011688901/job/27675682526?pr=3645) + ## [17.2.0] ### Added diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index 77d8a55ad8..ed4e34632c 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -423,8 +423,8 @@ export class AccountsController extends BaseController< ...account, metadata: { ...account.metadata, name: accountName }, }; - // Do not remove this comment: This error is flaky. Comment out and restore the `ts-expect-error` directive below as needed. - // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types + // Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed. + // // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types currentState.internalAccounts.accounts[accountId] = internalAccount; }); } diff --git a/packages/chain-controller/CHANGELOG.md b/packages/chain-controller/CHANGELOG.md index 9faa52486d..c2665a0e74 100644 --- a/packages/chain-controller/CHANGELOG.md +++ b/packages/chain-controller/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Uncategorized + +- Please hold off on new releases of this package until the yarn resolution for `@metamask/providers` is removed. + - This is blocked by a `@metamask/snaps-sdk` release with `@metamask/providers` bumped to `>=17.1.1`. + - See: [Fix regressions introduced by @metamask/providers@17.1.1](https://github.com/MetaMask/snaps/pull/2579) + - Build error fixed by yarn resolution: [MetaMask/core/actions/runs/10011688901/job/27675682526?pr=3645](https://github.com/MetaMask/core/actions/runs/10011688901/job/27675682526?pr=3645) + ## [0.1.0] ### Changed diff --git a/packages/profile-sync-controller/CHANGELOG.md b/packages/profile-sync-controller/CHANGELOG.md index ab2ad99ed2..e9cc1c654e 100644 --- a/packages/profile-sync-controller/CHANGELOG.md +++ b/packages/profile-sync-controller/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Uncategorized + +- Please hold off on new releases of this package until the yarn resolution for `@metamask/providers` is removed. + - This is blocked by a `@metamask/snaps-sdk` release with `@metamask/providers` bumped to `>=17.1.1`. + - See: [Fix regressions introduced by @metamask/providers@17.1.1](https://github.com/MetaMask/snaps/pull/2579) + - Build error fixed by yarn resolution: [MetaMask/core/actions/runs/10011688901/job/27675682526?pr=3645](https://github.com/MetaMask/core/actions/runs/10011688901/job/27675682526?pr=3645) + ## [0.1.4] ### Added diff --git a/yarn.lock b/yarn.lock index 21e8b603a4..605d50c97f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3548,28 +3548,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/providers@npm:17.0.0": - version: 17.0.0 - resolution: "@metamask/providers@npm:17.0.0" - dependencies: - "@metamask/json-rpc-engine": "npm:^8.0.1" - "@metamask/json-rpc-middleware-stream": "npm:^7.0.1" - "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/safe-event-emitter": "npm:^3.1.1" - "@metamask/utils": "npm:^8.3.0" - detect-browser: "npm:^5.2.0" - extension-port-stream: "npm:^3.0.0" - fast-deep-equal: "npm:^3.1.3" - is-stream: "npm:^2.0.0" - readable-stream: "npm:^3.6.2" - peerDependencies: - webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/9e6b84120276035c9d7e776da4f7e18243116c53fd0c33efca17034971981164720e808dff055e871d08b9ed9d78dc9ebd0d974238baa599d7d91e1560fc1abb - languageName: node - linkType: hard - -"@metamask/providers@npm:^17.0.0": +"@metamask/providers@npm:17.1.1, @metamask/providers@npm:^17.0.0": version: 17.1.1 resolution: "@metamask/providers@npm:17.1.1" dependencies: