@seams/wallet 0.30.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +7 -7
  2. package/THIRD_PARTY_NOTICES.md +1 -127
  3. package/dist/.build-inputs.sha256 +1 -1
  4. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuFooter.js +38 -10
  5. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.js +23 -67
  6. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/RecoveryOptions.js +60 -0
  7. package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/mountAuthMenuSurface.js +6 -0
  8. package/dist/esm/SeamsWeb/walletIframe/shared/authMenuPresentation.js +28 -0
  9. package/dist/esm/SeamsWeb/walletIframe/shared/messages.js +21 -10
  10. package/dist/esm/SeamsWeb/walletIframe/shared/walletAlternatives.js +4 -14
  11. package/dist/esm/core/ui/walletIcon.js +11 -3
  12. package/dist/esm/externalNear/controller.js +3 -2
  13. package/dist/esm/externalNear/meteor.js +1 -1
  14. package/dist/esm/externalNear/meteorRequest.js +8 -2
  15. package/dist/esm/react/components/HostedSeamsAuthMenu/shell.js +17 -1
  16. package/dist/esm/sdk/{host-Csu5L7VF.js → host-BsVFOugh.js} +1 -1
  17. package/dist/esm/sdk/ownerNearOperation-BsIdSH0C.js +1 -0
  18. package/dist/esm/sdk/registration-Coh0_Nva.js +1 -0
  19. package/dist/esm/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
  20. package/dist/esm/sdk/runtime-auth-CJCU2yJi.js +1 -0
  21. package/dist/esm/sdk/{runtime-device-link-DQe0aqRi.js → runtime-device-link-C0oXLSnz.js} +1 -1
  22. package/dist/esm/sdk/{runtime-ecdsa-tempo-DKkeMMpm.js → runtime-ecdsa-tempo-BC8u9NuI.js} +1 -1
  23. package/dist/esm/sdk/{runtime-email-otp-CzTe7r9I.js → runtime-email-otp-Cl4iu0z7.js} +1 -1
  24. package/dist/esm/sdk/{runtime-export-BiyLbdCe.js → runtime-export-BdhfErGJ.js} +1 -1
  25. package/dist/esm/sdk/{runtime-near-Kk0n1FSf.js → runtime-near-CT2ALBct.js} +1 -1
  26. package/dist/esm/sdk/{runtime-preferences-B-A3hddU.js → runtime-preferences-fN2G9tct.js} +1 -1
  27. package/dist/esm/sdk/{runtime-recovery-C9p1TU1w.js → runtime-recovery-n-TGLkwz.js} +1 -1
  28. package/dist/esm/sdk/{runtimeContext-ChuvOC0h.js → runtimeContext-DI28d8Qu.js} +1 -1
  29. package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
  30. package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
  31. package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
  32. package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
  33. package/dist/esm/sdk/wallet-service.css +2 -0
  34. package/dist/esm/sdk/wallet-ui.css +1 -1
  35. package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
  36. package/dist/esm/wasm/router_ab_ecdsa_client/pkg/router_ab_ecdsa_client_bg.wasm +0 -0
  37. package/dist/esm/wasm/router_ab_ed25519_yao_client/pkg/router_ab_ed25519_yao_client.d.ts +212 -233
  38. package/dist/esm/wasm/router_ab_ed25519_yao_client/pkg/router_ab_ed25519_yao_client.js +675 -694
  39. package/dist/esm/wasm/router_ab_ed25519_yao_client/pkg/router_ab_ed25519_yao_client_bg.wasm +0 -0
  40. package/dist/public/headers.manifest.json +1 -1
  41. package/dist/public/sdk/{host-Csu5L7VF.js → host-BsVFOugh.js} +1 -1
  42. package/dist/public/sdk/ownerNearOperation-BsIdSH0C.js +1 -0
  43. package/dist/public/sdk/registration-Coh0_Nva.js +1 -0
  44. package/dist/public/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
  45. package/dist/public/sdk/runtime-auth-CJCU2yJi.js +1 -0
  46. package/dist/public/sdk/{runtime-device-link-DQe0aqRi.js → runtime-device-link-C0oXLSnz.js} +1 -1
  47. package/dist/public/sdk/{runtime-ecdsa-tempo-DKkeMMpm.js → runtime-ecdsa-tempo-BC8u9NuI.js} +1 -1
  48. package/dist/public/sdk/{runtime-email-otp-CzTe7r9I.js → runtime-email-otp-Cl4iu0z7.js} +1 -1
  49. package/dist/public/sdk/{runtime-export-BiyLbdCe.js → runtime-export-BdhfErGJ.js} +1 -1
  50. package/dist/public/sdk/{runtime-near-Kk0n1FSf.js → runtime-near-CT2ALBct.js} +1 -1
  51. package/dist/public/sdk/{runtime-preferences-B-A3hddU.js → runtime-preferences-fN2G9tct.js} +1 -1
  52. package/dist/public/sdk/{runtime-recovery-C9p1TU1w.js → runtime-recovery-n-TGLkwz.js} +1 -1
  53. package/dist/public/sdk/{runtimeContext-ChuvOC0h.js → runtimeContext-DI28d8Qu.js} +1 -1
  54. package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
  55. package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
  56. package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
  57. package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
  58. package/dist/public/sdk/wallet-service.css +2 -0
  59. package/dist/public/sdk/wallet-ui.css +1 -1
  60. package/dist/public/sdk/workers/device-linking-key.worker.js +454 -947
  61. package/dist/public/sdk/workers/email-otp.worker.js +588 -820
  62. package/dist/public/sdk/workers/evm_crypto_bg.wasm +0 -0
  63. package/dist/public/sdk/workers/passkey-mpc-export.worker.js +572 -804
  64. package/dist/public/sdk/workers/router_ab_ecdsa_client_bg.wasm +0 -0
  65. package/dist/public/sdk/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
  66. package/dist/public/sdk/workers/tempo_signer_bg.wasm +0 -0
  67. package/dist/public/sdk/workers/wallet-custody-ceremony.worker.js +524 -971
  68. package/dist/public/sdk/workers/wallet_custody_ceremony_bg.wasm +0 -0
  69. package/dist/public/sdk/workers/wasm_signer_worker_bg.wasm +0 -0
  70. package/dist/public/wallet-assets.manifest.json +29 -29
  71. package/dist/public/wallet-service/index.html +4 -4
  72. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuFooter.d.ts +4 -0
  73. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.d.ts +3 -1
  74. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/RecoveryOptions.d.ts +11 -0
  75. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/ui/auth-menu/mountAuthMenuSurface.d.ts +3 -0
  76. package/dist/types/wallet/src/SeamsWeb/walletIframe/shared/authMenuPresentation.d.ts +13 -0
  77. package/dist/types/wallet/src/SeamsWeb/walletIframe/shared/messages.d.ts +7 -1
  78. package/dist/types/wallet/src/core/ui/walletIcon.d.ts +1 -0
  79. package/dist/types/wallet/src/externalNear/meteorRequest.d.ts +3 -0
  80. package/dist/types/wallet/src/index.d.ts +1 -1
  81. package/dist/types/wallet/src/react/components/HostedSeamsAuthMenu/public.d.ts +1 -1
  82. package/dist/types/wallet/src/react/components/HostedSeamsAuthMenu/types.d.ts +6 -2
  83. package/dist/types/wallet/src/react/index.d.ts +1 -1
  84. package/dist/workers/device-linking-key.worker.js +454 -947
  85. package/dist/workers/email-otp.worker.js +588 -820
  86. package/dist/workers/evm_crypto_bg.wasm +0 -0
  87. package/dist/workers/passkey-mpc-export.worker.js +572 -804
  88. package/dist/workers/router_ab_ecdsa_client_bg.wasm +0 -0
  89. package/dist/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
  90. package/dist/workers/tempo_signer_bg.wasm +0 -0
  91. package/dist/workers/wallet-custody-ceremony.worker.js +524 -971
  92. package/dist/workers/wallet_custody_ceremony_bg.wasm +0 -0
  93. package/dist/workers/wasm_signer_worker_bg.wasm +0 -0
  94. package/package.json +17 -17
  95. package/dist/esm/sdk/ownerNearOperation-DCxxHcwX.js +0 -1
  96. package/dist/esm/sdk/registration-C7w_51wE.js +0 -1
  97. package/dist/esm/sdk/runtime-auth-BMT_gIKI.js +0 -1
  98. package/dist/public/sdk/ownerNearOperation-DCxxHcwX.js +0 -1
  99. package/dist/public/sdk/registration-C7w_51wE.js +0 -1
  100. package/dist/public/sdk/runtime-auth-BMT_gIKI.js +0 -1
@@ -0,0 +1,60 @@
1
+ import { WalletText } from "../../../../../core/signingEngine/uiConfirm/ui/preact/WalletLocale.js";
2
+ import { chevronIcon, linkDeviceIcon, recoveryIcon } from "./icons.js";
3
+ import { jsx, jsxs } from "preact/jsx-runtime";
4
+ //#region src/SeamsWeb/walletIframe/host/ui/auth-menu/RecoveryOptions.tsx
5
+ function RecoveryOptions({ display, onLinkDevice, onRecovery }) {
6
+ if (display === "hidden") return null;
7
+ const options = /* @__PURE__ */ jsxs("div", {
8
+ class: "seams-menu-options",
9
+ children: [/* @__PURE__ */ jsxs("button", {
10
+ class: "seams-menu-option",
11
+ type: "button",
12
+ onClick: onLinkDevice,
13
+ children: [
14
+ /* @__PURE__ */ jsx("span", {
15
+ class: "seams-menu-option-icon",
16
+ children: linkDeviceIcon()
17
+ }),
18
+ /* @__PURE__ */ jsxs("span", {
19
+ class: "seams-menu-option-text",
20
+ children: [/* @__PURE__ */ jsx(WalletText, { message: "Link this device" }), /* @__PURE__ */ jsx("small", { children: /* @__PURE__ */ jsx(WalletText, { message: "Scan a code with your other device" }) })]
21
+ }),
22
+ chevronIcon()
23
+ ]
24
+ }), /* @__PURE__ */ jsxs("button", {
25
+ class: "seams-menu-option",
26
+ type: "button",
27
+ "data-recovery-action": true,
28
+ onClick: onRecovery,
29
+ children: [
30
+ /* @__PURE__ */ jsx("span", {
31
+ class: "seams-menu-option-icon",
32
+ children: recoveryIcon()
33
+ }),
34
+ /* @__PURE__ */ jsxs("span", {
35
+ class: "seams-menu-option-text",
36
+ children: [/* @__PURE__ */ jsx(WalletText, { message: "Recover wallet" }), /* @__PURE__ */ jsx("small", { children: /* @__PURE__ */ jsx(WalletText, { message: "Use your recovery code" }) })]
37
+ }),
38
+ chevronIcon()
39
+ ]
40
+ })]
41
+ });
42
+ switch (display) {
43
+ case "expanded": return /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("div", {
44
+ class: "seams-menu-options-label",
45
+ children: /* @__PURE__ */ jsx(WalletText, { copy: "Recover or link wallet" })
46
+ }), options] });
47
+ case "collapsible": return /* @__PURE__ */ jsxs("details", {
48
+ class: "seams-menu-expander",
49
+ children: [/* @__PURE__ */ jsxs("summary", { children: [/* @__PURE__ */ jsx(WalletText, { copy: "Recover or link wallet" }), chevronIcon()] }), options]
50
+ });
51
+ default: return assertNever(display);
52
+ }
53
+ }
54
+ function assertNever(value) {
55
+ throw new Error(`Unknown recovery display: ${value}`);
56
+ }
57
+ //#endregion
58
+ export { RecoveryOptions };
59
+
60
+ //# sourceMappingURL=RecoveryOptions.js.map
@@ -25,6 +25,8 @@ function authMenuStyles(document) {
25
25
  var MountedAuthMenuSurface = class {
26
26
  element;
27
27
  walletAlternatives;
28
+ recoveryOptions;
29
+ footerBrand;
28
30
  walletConnection = { kind: "idle" };
29
31
  viewModel;
30
32
  styles;
@@ -32,6 +34,8 @@ var MountedAuthMenuSurface = class {
32
34
  state;
33
35
  constructor(input) {
34
36
  this.walletAlternatives = input.walletAlternatives ?? emptyWalletAlternatives();
37
+ this.recoveryOptions = input.recoveryOptions ?? "collapsible";
38
+ this.footerBrand = input.footerBrand ?? { kind: "seams" };
35
39
  this.viewModel = input.viewModel;
36
40
  const document = input.parent.ownerDocument;
37
41
  this.styles = authMenuStyles(document);
@@ -90,6 +94,8 @@ var MountedAuthMenuSurface = class {
90
94
  element: this.element,
91
95
  viewModel,
92
96
  walletAlternatives: this.walletAlternatives,
97
+ recoveryOptions: this.recoveryOptions,
98
+ footerBrand: this.footerBrand,
93
99
  walletConnection: this.walletConnection,
94
100
  onIntent: this.state.onIntent,
95
101
  styles: this.styles
@@ -0,0 +1,28 @@
1
+ import { isPlainObject } from "../../../shared-ts/src/utils/validation.js";
2
+ import { parseWalletImageUrl } from "../../../core/ui/walletIcon.js";
3
+ //#region src/SeamsWeb/walletIframe/shared/authMenuPresentation.ts
4
+ function parseAuthMenuRecoveryOptions(value) {
5
+ if (value === void 0) return "collapsible";
6
+ switch (value) {
7
+ case "collapsible": return "collapsible";
8
+ case "expanded": return "expanded";
9
+ case "hidden": return "hidden";
10
+ default: return null;
11
+ }
12
+ }
13
+ function parseAuthMenuFooterBrand(value) {
14
+ if (value === void 0) return { kind: "seams" };
15
+ if (!isPlainObject(value)) return null;
16
+ if (value.kind === "seams" && Object.keys(value).length === 1) return { kind: "seams" };
17
+ if (value.kind !== "custom" || Object.keys(value).length !== 3 || typeof value.name !== "string" || !value.name.trim() || value.name.length > 512) return null;
18
+ const logo = parseWalletImageUrl(value.logo);
19
+ return logo ? {
20
+ kind: "custom",
21
+ logo,
22
+ name: value.name.trim()
23
+ } : null;
24
+ }
25
+ //#endregion
26
+ export { parseAuthMenuFooterBrand, parseAuthMenuRecoveryOptions };
27
+
28
+ //# sourceMappingURL=authMenuPresentation.js.map
@@ -1,6 +1,7 @@
1
1
  import { isPlainObject } from "../../../shared-ts/src/utils/validation.js";
2
2
  import { parseWalletAuthMethodId, parseWalletId } from "../../../shared-ts/src/utils/domainIds.js";
3
3
  import { parseWalletSessionHome } from "../../../shared-ts/src/device-linking/activeWalletSession.js";
4
+ import { parseAuthMenuFooterBrand, parseAuthMenuRecoveryOptions } from "./authMenuPresentation.js";
4
5
  import { walletIframeRequestIdFromBoundary } from "../../../core/types/walletIframeIdentity.js";
5
6
  import { emptyWalletAlternatives, parseWalletAlternatives } from "./walletAlternatives.js";
6
7
  //#region src/SeamsWeb/walletIframe/shared/messages.ts
@@ -211,7 +212,9 @@ function parseHostedAuthMenuOpenRequest(value) {
211
212
  "showProgress",
212
213
  "copy",
213
214
  "enabledExternalProviders",
214
- "walletAlternatives"
215
+ "walletAlternatives",
216
+ "recoveryOptions",
217
+ "footerBrand"
215
218
  ]) || !hasOnlyHostedAuthMenuCopyKeys(record.copy)) return null;
216
219
  const authMenuSessionId = hostedAuthMenuSessionIdFromBoundary(record.authMenuSessionId);
217
220
  const initialMode = parseAuthMenuMode(record.initialMode);
@@ -228,8 +231,10 @@ function parseHostedAuthMenuOpenRequest(value) {
228
231
  } : null;
229
232
  const registrationAccountInput = parseRegistrationAccountInput(record.registrationAccountInput);
230
233
  const providers = parseExternalProviders(record.enabledExternalProviders);
234
+ const recoveryOptions = parseAuthMenuRecoveryOptions(record.recoveryOptions);
235
+ const footerBrand = parseAuthMenuFooterBrand(record.footerBrand);
231
236
  const walletAlternatives = record.walletAlternatives === void 0 ? emptyWalletAlternatives() : parseWalletAlternatives(record.walletAlternatives);
232
- if (!authMenuSessionId || !initialMode || !loginTarget || !registrationAccountInput || typeof record.showRegistrationInput !== "boolean" || typeof record.showProgress !== "boolean" || !providers || !walletAlternatives || !isWireSerializable(record.copy, /* @__PURE__ */ new Set(), true)) return null;
237
+ if (!authMenuSessionId || !initialMode || !loginTarget || !registrationAccountInput || typeof record.showRegistrationInput !== "boolean" || typeof record.showProgress !== "boolean" || !providers || !walletAlternatives || !recoveryOptions || !footerBrand || !isWireSerializable(record.copy, /* @__PURE__ */ new Set(), true)) return null;
233
238
  return {
234
239
  kind: "hosted_auth_menu_open_v1",
235
240
  authMenuSessionId,
@@ -241,7 +246,9 @@ function parseHostedAuthMenuOpenRequest(value) {
241
246
  showProgress: record.showProgress,
242
247
  copy: normalizeHostedAuthMenuCopy(record.copy),
243
248
  enabledExternalProviders: providers,
244
- walletAlternatives
249
+ walletAlternatives,
250
+ recoveryOptions,
251
+ footerBrand
245
252
  };
246
253
  }
247
254
  function buildHostedAuthMenuOpenRequest(args) {
@@ -257,11 +264,13 @@ function buildHostedAuthMenuOpenRequest(args) {
257
264
  "showProgress",
258
265
  "copy",
259
266
  "enabledExternalProviders",
260
- "walletAlternatives"
267
+ "walletAlternatives",
268
+ "recoveryOptions",
269
+ "footerBrand"
261
270
  ]) || args.copy !== void 0 && !hasOnlyHostedAuthMenuCopyKeys(args.copy)) throw new Error("Hosted auth-menu open configuration contains unsupported fields");
262
271
  const parsedSessionId = hostedAuthMenuSessionIdFromBoundary(args.authMenuSessionId);
263
272
  if (!parsedSessionId) throw new Error("authMenuSessionId must be a non-empty string");
264
- const request = {
273
+ const parsed = parseHostedAuthMenuOpenRequest({
265
274
  kind: "hosted_auth_menu_open_v1",
266
275
  authMenuSessionId: parsedSessionId,
267
276
  initialMode: args.initialMode ?? "login",
@@ -272,10 +281,12 @@ function buildHostedAuthMenuOpenRequest(args) {
272
281
  showProgress: args.showProgress ?? false,
273
282
  copy: normalizeHostedAuthMenuCopy(args.copy),
274
283
  enabledExternalProviders: [...args.enabledExternalProviders ?? []],
275
- walletAlternatives: args.walletAlternatives ?? emptyWalletAlternatives()
276
- };
277
- if (!parseHostedAuthMenuOpenRequest(request)) throw new Error("Hosted auth-menu open request is invalid");
278
- return Object.freeze(request);
284
+ walletAlternatives: args.walletAlternatives ?? emptyWalletAlternatives(),
285
+ recoveryOptions: args.recoveryOptions ?? "collapsible",
286
+ footerBrand: args.footerBrand ?? { kind: "seams" }
287
+ });
288
+ if (!parsed) throw new Error("Hosted auth-menu open request is invalid");
289
+ return Object.freeze(parsed);
279
290
  }
280
291
  function parseHostedAuthMenuExternalAuthRequest(value) {
281
292
  const record = recordFromBoundary(value);
@@ -484,7 +495,7 @@ function parseHostedAuthMenuOutcome(value) {
484
495
  default: return null;
485
496
  }
486
497
  }
487
- const WALLET_PROTOCOL_VERSION = "20.0.0";
498
+ const WALLET_PROTOCOL_VERSION = "21.0.0";
488
499
  const WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH = "WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH";
489
500
  const HOSTED_WALLET_REDEMPTION_PAYLOAD_FIELDS = [
490
501
  "home",
@@ -1,5 +1,5 @@
1
1
  import { isPlainObject } from "../../../shared-ts/src/utils/validation.js";
2
- import { parseWalletDataIcon } from "../../../core/ui/walletIcon.js";
2
+ import { parseWalletImageUrl } from "../../../core/ui/walletIcon.js";
3
3
  import { walletIframeRequestIdFromBoundary } from "../../../core/types/walletIframeIdentity.js";
4
4
  import { hostedAuthMenuSessionIdFromBoundary } from "./messages.js";
5
5
  //#region src/SeamsWeb/walletIframe/shared/walletAlternatives.ts
@@ -17,21 +17,11 @@ function parseWalletIcon(value) {
17
17
  ok: true,
18
18
  value: null
19
19
  };
20
- const dataIcon = parseWalletDataIcon(value);
21
- if (dataIcon !== null) return {
20
+ const icon = parseWalletImageUrl(value);
21
+ return icon === null ? { ok: false } : {
22
22
  ok: true,
23
- value: dataIcon
23
+ value: icon
24
24
  };
25
- if (typeof value !== "string" || value.length > 131072) return { ok: false };
26
- try {
27
- if (new URL(value).protocol === "https:") return {
28
- ok: true,
29
- value
30
- };
31
- } catch {
32
- return { ok: false };
33
- }
34
- return { ok: false };
35
25
  }
36
26
  function parseWalletRows(value, ids) {
37
27
  if (!Array.isArray(value) || value.length > 32) return null;
@@ -1,10 +1,18 @@
1
- //#region src/core/ui/walletIcon.ts
2
- const MAX_WALLET_ICON_LENGTH = 131072;
1
+ function parseWalletImageUrl(value) {
2
+ const dataIcon = parseWalletDataIcon(value);
3
+ if (dataIcon !== null) return dataIcon;
4
+ if (typeof value !== "string" || value.length > 131072) return null;
5
+ try {
6
+ return new URL(value).protocol === "https:" ? value : null;
7
+ } catch {
8
+ return null;
9
+ }
10
+ }
3
11
  function parseWalletDataIcon(value) {
4
12
  if (typeof value !== "string" || value.length > 131072 || !/^data:image\/(?:png|webp|jpeg|svg\+xml)[;,]/i.test(value)) return null;
5
13
  return value;
6
14
  }
7
15
  //#endregion
8
- export { MAX_WALLET_ICON_LENGTH, parseWalletDataIcon };
16
+ export { parseWalletDataIcon, parseWalletImageUrl };
9
17
 
10
18
  //# sourceMappingURL=walletIcon.js.map
@@ -1,5 +1,6 @@
1
1
  import { createNearWalletProvider, nearWalletName } from "./wallets.js";
2
2
  import { connectedNear } from "./types.js";
3
+ import { MeteorTransportUnavailableError } from "./meteorRequest.js";
3
4
  import { executionStatus, parseAccounts, parseSubmission, validateTransaction } from "./boundary.js";
4
5
  import { parseSignedMessage, validateMessage } from "./message.js";
5
6
  //#region src/externalNear/controller.ts
@@ -86,10 +87,10 @@ var ExternalNearController = class {
86
87
  ok: true,
87
88
  value: connection
88
89
  };
89
- } catch {
90
+ } catch (error) {
90
91
  if (generation !== this.generation) return failure("connection_changed", "Wallet selection changed.");
91
92
  this.disconnect();
92
- return failure("unavailable", `${nearWalletName(wallet)} did not connect. Check the wallet and network, then try again.`);
93
+ return failure("unavailable", error instanceof MeteorTransportUnavailableError ? error.message : `${nearWalletName(wallet)} did not connect. Check the wallet and network, then try again.`);
93
94
  } finally {
94
95
  if (generation === this.generation) {
95
96
  this.pending = false;
@@ -3,8 +3,8 @@ import { base64Encode } from "../shared-ts/src/utils/base64.js";
3
3
  import { base58Decode } from "../shared-ts/src/utils/base58.js";
4
4
  import { isValidAccountId } from "../shared-ts/src/utils/near.js";
5
5
  import { ActionType, toActionArgsWasm } from "../shared-ts/src/near/actions.js";
6
- import { serialize } from "../node_modules/borsh/lib/esm/index.js";
7
6
  import { MeteorRequest, meteorTransportFromWindow } from "./meteorRequest.js";
7
+ import { serialize } from "../node_modules/borsh/lib/esm/index.js";
8
8
  //#region src/externalNear/meteor.ts
9
9
  const transactionSchema = { struct: {
10
10
  signerId: "string",
@@ -1,8 +1,14 @@
1
1
  import { isFunction, isPlainObject } from "../shared-ts/src/utils/validation.js";
2
2
  //#region src/externalNear/meteorRequest.ts
3
+ var MeteorTransportUnavailableError = class extends Error {
4
+ constructor() {
5
+ super("Open the Meteor extension and allow access to this site, then try again.");
6
+ this.name = "MeteorTransportUnavailableError";
7
+ }
8
+ };
3
9
  function meteorTransportFromWindow() {
4
10
  const raw = Reflect.get(window, "meteorComV2");
5
- if (!isPlainObject(raw) || !isFunction(raw.sendMessageDataAndRespond)) throw new Error("Meteor extension is not ready.");
11
+ if (!isPlainObject(raw) || !isFunction(raw.sendMessageDataAndRespond)) throw new MeteorTransportUnavailableError();
6
12
  const method = raw.sendMessageDataAndRespond;
7
13
  return { sendMessageDataAndRespond: callMeteor.bind(null, raw, method) };
8
14
  }
@@ -112,6 +118,6 @@ var MeteorRequest = class {
112
118
  function ignoreResult(_value) {}
113
119
  function ignoreError(_error) {}
114
120
  //#endregion
115
- export { MeteorRequest, meteorTransportFromWindow };
121
+ export { MeteorRequest, MeteorTransportUnavailableError, meteorTransportFromWindow };
116
122
 
117
123
  //# sourceMappingURL=meteorRequest.js.map
@@ -84,6 +84,8 @@ function hostedAuthMenuEffectConfigKey(config) {
84
84
  showRegistrationInput: config.showRegistrationInput,
85
85
  showProgress: config.showProgress,
86
86
  copy: config.copy,
87
+ recoveryOptions: config.recoveryOptions,
88
+ footerBrand: config.footerBrand,
87
89
  enabledExternalProviders: config.enabledExternalProviders,
88
90
  walletAlternatives: describeWalletAlternatives(config.walletAlternatives)
89
91
  });
@@ -94,6 +96,8 @@ function hostedAuthMenuEffectConfigKey(config) {
94
96
  showRegistrationInput: normalized.showRegistrationInput,
95
97
  showProgress: normalized.showProgress,
96
98
  copy: normalized.copy,
99
+ recoveryOptions: normalized.recoveryOptions,
100
+ footerBrand: normalized.footerBrand,
97
101
  enabledExternalProviders: normalized.enabledExternalProviders,
98
102
  walletAlternatives: normalized.walletAlternatives,
99
103
  walletControllers: walletAlternativesControllerKey(config.walletAlternatives)
@@ -112,6 +116,8 @@ var HostedAuthMenuSessionController = class {
112
116
  showRegistrationInput;
113
117
  showProgress;
114
118
  copy;
119
+ recoveryOptions;
120
+ footerBrand;
115
121
  externalAuthBroker;
116
122
  walletAlternatives;
117
123
  walletBroker;
@@ -133,6 +139,8 @@ var HostedAuthMenuSessionController = class {
133
139
  this.showRegistrationInput = args.showRegistrationInput;
134
140
  this.showProgress = args.showProgress;
135
141
  this.copy = args.copy;
142
+ this.recoveryOptions = args.recoveryOptions;
143
+ this.footerBrand = args.footerBrand;
136
144
  this.externalAuthBroker = args.externalAuthBroker;
137
145
  this.walletAlternatives = args.walletAlternatives;
138
146
  this.walletBroker = new WalletAlternativesBroker(args.seams.authMenu, args.authMenuSessionId, args.walletAlternatives);
@@ -171,6 +179,8 @@ var HostedAuthMenuSessionController = class {
171
179
  showRegistrationInput: this.showRegistrationInput,
172
180
  showProgress: this.showProgress,
173
181
  copy: this.copy,
182
+ recoveryOptions: this.recoveryOptions,
183
+ footerBrand: this.footerBrand,
174
184
  enabledExternalProviders: this.externalAuthBroker.current ? ["google"] : [],
175
185
  walletAlternatives: describeWalletAlternatives(this.walletAlternatives.current)
176
186
  });
@@ -289,7 +299,7 @@ function forwardHostedAuthMenuOutcome(terminalGateRef, onOutcomeRef, outcome) {
289
299
  if (isTerminalHostedAuthMenuSuccess(outcome) && terminalGateRef.current) terminalGateRef.current.completed = true;
290
300
  onOutcomeRef.current(outcome);
291
301
  }
292
- const HostedSeamsAuthMenu = ({ initialMode = "login", initialHeightCssPx, placeholder, registrationAccountInput = "implicit_wallet", showRegistrationInput = false, showProgress = false, copy, externalAuthBroker = null, walletAlternatives, onOutcome }) => {
302
+ const HostedSeamsAuthMenu = ({ initialMode = "login", initialHeightCssPx, placeholder, registrationAccountInput = "implicit_wallet", showRegistrationInput = false, showProgress = false, copy, recoveryOptions, footerBrand, externalAuthBroker = null, walletAlternatives, onOutcome }) => {
293
303
  const { seams, isLoggedIn } = useOptionalSeams();
294
304
  const terminalGate = terminalGateFor(seams);
295
305
  syncTerminalGate(terminalGate, isLoggedIn);
@@ -300,6 +310,8 @@ const HostedSeamsAuthMenu = ({ initialMode = "login", initialHeightCssPx, placeh
300
310
  showRegistrationInput,
301
311
  showProgress,
302
312
  copy,
313
+ recoveryOptions,
314
+ footerBrand,
303
315
  enabledExternalProviders: externalProvidersForBroker(externalAuthBroker),
304
316
  walletAlternatives
305
317
  });
@@ -317,6 +329,8 @@ const HostedSeamsAuthMenu = ({ initialMode = "login", initialHeightCssPx, placeh
317
329
  showRegistrationInput,
318
330
  showProgress,
319
331
  copy,
332
+ recoveryOptions,
333
+ footerBrand,
320
334
  enabledExternalProviders: externalProvidersForBroker(externalAuthBroker),
321
335
  walletAlternatives
322
336
  };
@@ -341,6 +355,8 @@ const HostedSeamsAuthMenu = ({ initialMode = "login", initialHeightCssPx, placeh
341
355
  showRegistrationInput: config.showRegistrationInput,
342
356
  showProgress: config.showProgress,
343
357
  copy: config.copy,
358
+ recoveryOptions: config.recoveryOptions,
359
+ footerBrand: config.footerBrand,
344
360
  externalAuthBroker: externalAuthBrokerRef,
345
361
  walletAlternatives: walletAlternativesRef,
346
362
  onOutcome: forwardedOutcomeRef
@@ -1 +1 @@
1
- import{g as e,h as t}from"./digests-BIaE0DMd.js";import{n}from"./walletRegistrationSetupPrewarm-CEvGKQSg.js";import{t as r}from"./walletDbName-B6-CV_Rq.js";import{n as i,r as a,t as o}from"./configuration-BAad7ngq.js";import{a as ee,i as s,n as te,o as ne,r as re,t as c}from"./transactionReview-CGIlI835.js";import{t as l}from"./events-D6l0_ugy.js";import{i as u,n as d,t as ie}from"./transactionReviewAdmission-Cf_qUZJt.js";import{A as f,D as p,S as m,T as h,d as g,f as _,h as v,k as y,m as b,o as x,t as S,u as C,x as w,y as T}from"./ownerNearOperation-DCxxHcwX.js";import{t as E}from"./walletIframeIdentity-Cz82I_Uh.js";import{t as ae}from"./errors-BJBDbwHk.js";import{s as D}from"./ed25519OperationFingerprint-Dev4P6Og.js";function O(){let e=globalThis;e.global===void 0&&(e.global=globalThis),!e.process||typeof e.process!=`object`?e.process={env:{}}:(!e.process.env||typeof e.process.env!=`object`)&&(e.process.env={})}function k(){O(),window.location.origin===`null`&&(window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`),console.warn(`[WalletHost] iframe is running with opaque (null) origin. Check COEP/CORP headers and ensure navigation succeeded.`)),A(),window.parent?.postMessage({type:`SERVICE_HOST_BOOTED`},`*`),window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`);let e=new URL(import.meta.url),t=e.searchParams.get(`v`);t&&y(t);let n=new URL(`.`,e).toString(),r=n.endsWith(`/`)?n:n+`/`;p()||f(r)}function A(){let e=()=>{let e=document;e.documentElement.classList.add(`seams-transparent`),e.body?.classList.add(`seams-transparent`),e.documentElement.classList.remove(`dark`),e.body?.classList.remove(`dark`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e(),window.addEventListener(`load`,()=>e(),{once:!0})}const j={};let M=null,N=null;function oe(e){return e.request.type===`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`?e.request.payload?.authorization?.kind===`email_otp`?P(e.kind):(M??=import(`./runtime-recovery-codes-CFOWDVd9.js`),M):P(e.kind)}function se(){P(`auth`).catch(ce)}function ce(){}function P(e){let t=j[e];if(t)return t;let n=I(e);return j[e]=n,n.catch(le.bind(null,e,n)),n}function le(e,t){j[e]===t&&delete j[e]}async function F(){M??=import(`./runtime-recovery-codes-CFOWDVd9.js`),N??=Promise.all([M,import(`./mountRecoveryCodeBackupSurface-CMtByh-L.js`)]).then(()=>void 0),await N}function I(e){switch(e){case`auth`:return import(`./runtime-auth-BMT_gIKI.js`);case`near`:return import(`./runtime-near-Kk0n1FSf.js`);case`ecdsa`:return import(`./runtime-ecdsa-tempo-DKkeMMpm.js`);case`email_otp`:return import(`./runtime-email-otp-CzTe7r9I.js`);case`recovery`:return import(`./runtime-recovery-C9p1TU1w.js`);case`export`:return import(`./runtime-export-BiyLbdCe.js`);case`device_link`:return import(`./runtime-device-link-DQe0aqRi.js`);case`preferences`:return import(`./runtime-preferences-B-A3hddU.js`)}return L(e)}function L(e){throw Error(`Unhandled wallet host runtime route: ${String(e)}`)}function R(e){switch(e.type){case`PM_GET_RECENT_UNLOCKS`:case`PM_GET_CONFIRMATION_CONFIG`:return!0;case`PM_GET_EXACT_WALLET_SESSION_STATE`:{let t=e.request.payload;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`authenticationRead`),r=Reflect.get(t,`wallet`);return(n===`restore`||n===`current`)&&!!r&&typeof r==`object`&&Reflect.get(r,`kind`)===`current`}default:return!1}}function z(e){switch(e.type){case`PM_GET_EXACT_WALLET_SESSION_STATE`:return{revision:C(),walletId:null,state:{kind:`wallet_locked`},session:g()};case`PM_GET_RECENT_UNLOCKS`:return{walletIds:[],accountIds:[],accounts:[],lastUsedAccount:null};case`PM_GET_CONFIRMATION_CONFIG`:return{walletId:null,confirmationConfig:D,revision:0}}}let B=null;function V(){return B??=U().finally(H),B}function H(){B=null}async function U(){try{return typeof indexedDB>`u`||typeof indexedDB.databases!=`function`?!1:(await indexedDB.databases()).some(ue)?await de():!0}catch{return!1}}function ue(e){return e.name===r}function de(){return new Promise(e=>{let t=indexedDB.open(r);t.onupgradeneeded=()=>t.transaction?.abort(),t.onerror=()=>e(!1),t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>n.close(),fe(n).then(t=>{n.close(),e(t===0)},()=>{n.close(),e(!1)})}})}function fe(e){let t=Array.from(e.objectStoreNames);return t.length===0?Promise.resolve(0):new Promise((n,r)=>{let i=e.transaction(t,`readonly`),a=0;for(let e of t){let t=i.objectStore(e).count();t.onsuccess=()=>{a+=t.result}}i.oncomplete=()=>n(a),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)})}function pe(e){throw Error(`Unhandled wallet host route: ${String(e)}`)}function W(e,t){if(e===null)throw Error(`Invalid ${t} payload`);return e}function G(e){try{return E(e)}catch{throw Error(`Hosted auth-menu request requires a non-empty requestId`)}}function me(e){switch(e.type){case`PM_ACTIVATE_TRANSACTION_REVIEW`:case`PING`:case`PM_PREPARE_WALLET_RUNTIME`:case`PM_SET_CONFIG`:case`PM_CANCEL`:case`PM_SET_TRANSACTION_VIEW`:case`PM_TRANSACTION_BROADCAST_STARTED`:return{kind:`boot`,type:e.type,request:e};case`PM_OWNER_NEAR_TRANSACTION`:return{kind:`near`,type:e.type,request:{type:e.type,requestId:E(e.requestId),payload:S(e.payload)}};case`PM_REGISTER_WALLET`:case`PM_ADD_WALLET_SIGNER`:case`PM_ADD_PASSKEY`:case`PM_ACTIVATE_AUTH_METHOD`:case`PM_GET_AUTH_METHOD_AVAILABILITY`:case`PM_SET_AUTH_METHOD_ENABLED`:case`PM_ADD_EMAIL_OTP`:case`PM_REVOKE_AUTH_METHOD`:case`PM_GET_NEAR_PROVISIONING_STATE`:case`PM_SIGN_TX_WITH_ACTIONS`:case`PM_SIGN_AND_SEND_TX`:case`PM_SEND_TRANSACTION`:case`PM_SIGN_DELEGATE_ACTION`:case`PM_SIGN_NEP413`:return{kind:`near`,type:e.type,request:e};case`PM_OPEN_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(m(e.payload),`hosted auth-menu open`)}}}case`PM_CANCEL_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(T(e.payload),`hosted auth-menu cancellation`)}}}case`PM_RESOLVE_WALLET_CONNECTION`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(h(e.payload),`wallet connection resolution`)}}}case`PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(w(e.payload),`hosted auth-menu external-auth resolution`)}}}case`PM_EXTERNAL_OWNER_AUTH`:{let t=x(e.payload);if(t.action!==`associate`&&t.action!==`unlink`)throw Error(`Owner request is invalid`);return{kind:`auth`,type:e.type,request:{type:e.type,requestId:E(e.requestId),payload:t,options:e.options}}}case`PM_UNLOCK`:case`PM_UNLOCK_AUTH_METHOD`:case`PM_EXTERNAL_AUTH`:case`PM_LOCK`:case`PM_LOCK_EXACT_WALLET_SESSION`:case`PM_GET_LAST_WALLET_MOVE_REQUEST`:case`PM_MOVE_WALLET`:case`PM_GET_WALLET_MOVE`:case`PM_GET_WALLET_PLACEMENT`:case`PM_GET_WALLET_SESSION`:case`PM_GET_EXACT_WALLET_SESSION_STATE`:case`PM_GET_RECENT_UNLOCKS`:return{kind:`auth`,type:e.type,request:e};case`PM_SIGN_TEMPO`:case`PM_REPORT_TEMPO_BROADCAST_ACCEPTED`:case`PM_REPORT_TEMPO_BROADCAST_REJECTED`:case`PM_REPORT_TEMPO_FINALIZED`:case`PM_REPORT_TEMPO_DROPPED_OR_REPLACED`:case`PM_RECONCILE_TEMPO_NONCE_LANE`:return{kind:`ecdsa`,type:e.type,request:e};case`PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION`:case`PM_REQUEST_EMAIL_OTP_CHALLENGE`:case`PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL`:case`PM_GET_WALLET_RECOVERY_CODE_STATUS`:case`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`:case`PM_ROTATE_WALLET_RECOVERY_CODES`:case`PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE`:return{kind:`email_otp`,type:e.type,request:e};case`PM_SYNC_ACCOUNT_FLOW`:return{kind:`recovery`,type:e.type,request:e};case`PM_RESOLVE_EXACT_KEY_EXPORT_LANE`:case`PM_EXPORT_KEYPAIR_UI`:return{kind:`export`,type:e.type,request:e};case`PM_HAS_PASSKEY`:case`PM_LIST_LINKED_DEVICES`:case`PM_REVOKE_LINKED_DEVICE`:case`PM_SCAN_AND_LINK_DEVICE`:case`PM_START_DEVICE2_LINKING_FLOW`:case`PM_DEVICE_LINK_TARGET_FACTOR_ACTION`:case`PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION`:case`PM_CANCEL_DEVICE_LINKING`:return{kind:`device_link`,type:e.type,request:e};case`PM_SET_CONFIRM_BEHAVIOR`:case`PM_SET_CONFIRMATION_CONFIG`:case`PM_GET_CONFIRMATION_CONFIG`:return{kind:`preferences`,type:e.type,request:e}}return pe(e)}function he(e){return e.kind!==`boot`}let K=!1;const ge=[{selector:`.seams-auth-menu-surface`,cancellationKind:`native_cancel`},{selector:`.seams-confirmation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-auth-method-activation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-export-surface`,cancellationKind:`wallet_iframe_cancel`},{selector:`[data-seams-wallet-recovery-backup-dialog]`,cancellationKind:`native_cancel`}];function q(e,t){let n=new Set(t),r=Object.keys(e);return r.length===t.length&&r.every(e=>n.has(e))}function _e(t){return!e(t)||!q(t,[`type`,`payload`])||t.type!==`CONNECT`||!e(t.payload)||!q(t.payload,[`protocolVersion`])?null:typeof t.payload.protocolVersion==`string`?{type:`CONNECT`,payload:{protocolVersion:t.payload.protocolVersion}}:null}function ve(e){if(e===`null`)return!0;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.origin===e}catch{return!1}}function J(e){try{e.close()}catch{}}function Y(e,t){if(t===`20.0.0`)return!1;let n={expectedProtocolVersion:v,receivedProtocolVersion:t};try{e.postMessage({type:`ERROR`,payload:{code:b,message:`Wallet iframe protocol version mismatch: expected ${v}, received ${t??`missing`}`,details:n}})}catch{}return J(e),!0}function X(e,t){return!t||t.has(e)}function Z(e,t,n,r){e.executionGeneration===t&&n(r)}function ye(e,t,n,r){if(t===`PM_SIGN_AND_SEND_TX`){e({type:`PM_RESULT`,requestId:n,payload:{ok:!0,result:_(r,`not_submitted`)}});return}e({type:`ERROR`,requestId:n,payload:{code:r instanceof c?r.code:`cancelled`,message:r.message}})}function Q(e,t,n,r){return e.executionGeneration!==t||n(r)}function $(e={}){if(K)return;K=!0,k(),(!e.supportedRuntimeRouteKinds||e.supportedRuntimeRouteKinds.has(`email_otp`))&&F().catch(()=>void 0);let r=new Set,f=new Set,p=new Set,m=!1,h={parentOrigin:null,port:null,configuration:{kind:`unconfigured`},executionGeneration:0,onConfigurationChanged:null},g=e=>{try{h.port?.postMessage(e)}catch{}},y=e=>{e&&r.add(e)},b=e=>!!e&&(r.has(e)||u(e)?.cancelled===!0),x=e=>{e&&r.delete(e)},S=e=>{e&&g({type:`ERROR`,requestId:e,payload:{code:`cancelled`,message:`Request cancelled`}})},C=e=>!e||!b(e)?!1:u(e)?.cancelled?!0:(S(e),x(e),!0),w=()=>{for(let e of ge){let t=document.querySelectorAll(e.selector);for(let n of t)try{e.cancellationKind===`native_cancel`?n.dispatchEvent(new Event(`cancel`,{cancelable:!0})):n.dispatchEvent(new CustomEvent(l.TX_CONFIRMER_CANCEL,{bubbles:!0,composed:!0}))}catch{}}},T=async r=>{let l=r.data;if(!l||!t(l))return;let v=l.requestId,T=typeof v==`string`&&l.type!==`PM_CANCEL`;if(T){if(p.has(v)){g({type:`ERROR`,requestId:v,payload:{code:`request_in_progress`,message:`Request identity is already active`}});return}p.add(v)}let E=h.executionGeneration,D=Z.bind(null,h,E,g),O=null,k=`admission`;try{let t=l.type.startsWith(`PM_SIGN_`)?await(await import(`./runtimeContext-ChuvOC0h.js`)).walletAuthMethodReviewPolicy(h,l):{kind:`disabled`};if(h.executionGeneration!==E||b(v))return;if(`transactionReview`in l){if(l.type!==`PM_SIGN_AND_SEND_TX`&&l.type!==`PM_SIGN_TEMPO`)throw new c(`review_invalid_input`,`Review is unsupported for this request`);let e=s(l.transactionReview);if(e.requestId!==v)throw new c(`review_invalid_input`,`Review request identity mismatch`);let n=l.payload?.options?.confirmationConfig;if(n?.uiMode!==`modal`||n.behavior!==`requireClick`)throw new c(`review_unsupported_mode`,`Review requires modal presentation and explicit approval`);O=new ie(e,l.type===`PM_SIGN_TEMPO`&&l.payload?.request.senderSignatureAlgorithm!==`secp256k1`?`credential`:`mpc`,e=>D({type:`TRANSACTION_REVIEW_STATE`,requestId:v,payload:e}),ye.bind(null,D,l.type,v),t)}(l.type===`PM_LOCK`||l.type===`PM_LOCK_EXACT_WALLET_SESSION`)&&d(new c(`review_identity_changed`,`The wallet session changed`));let r=me(l);if(!he(r))switch(r.type){case`PING`:g({type:`PONG`,requestId:v});return;case`PM_PREPARE_WALLET_RUNTIME`:X(`auth`,e.supportedRuntimeRouteKinds)&&se(),g({type:`PONG`,requestId:v});return;case`PM_SET_CONFIG`:{let e=o(h.configuration,i(r.request.payload)),t=a(h.configuration.kind===`configured`?h.configuration.config:null)!==a(e.config);if(h.configuration=e,t){h.executionGeneration+=1;let t=e.config;t.registration.publishableKey&&t.registration.projectEnvironmentId&&n(t.network.relayer.url);for(let e of f)g({type:`ERROR`,requestId:e,payload:{code:`wallet_configuration_changed`,message:`Wallet configuration changed during request`}});f.clear()}h.onConfigurationChanged?.(),t&&(d(new c(`review_identity_changed`,`Wallet execution configuration changed`)),w()),g({type:`PONG`,requestId:v});return}case`PM_ACTIVATE_TRANSACTION_REVIEW`:{let e=re(r.request.payload);e&&u(e.requestId)?.activate(e);return}case`PM_CANCEL`:{let e=r.request.payload?.requestId,t=r.request.payload,n=t&&typeof t==`object`?Reflect.get(t,`transactionReview`):void 0;if(n!==void 0){let r=s(n),i=u(r.requestId);if(r.requestId===e&&i&&ee(r,i.metadata)){let e=new c(ne(t&&typeof t==`object`?Reflect.get(t,`reviewErrorCode`):void 0),`Reviewed request cancelled`);try{te(i.metadata.validity)}catch(t){t instanceof Error&&(e=t)}i.cancel(e)}g({type:`PONG`,requestId:v});return}let i=e?u(e):void 0;if(i){i.cancel(new c(`cancelled`,`Request cancelled`)),g({type:`PONG`,requestId:v});return}y(e),(await import(`./deviceLinkApproval-C4T8XAmi.js`).then(e=>e.i)).cancelDeviceLinkApproval(typeof e==`string`?{kind:`request`,requestId:e}:{kind:`all`}),w(),e&&S(e),g({type:`PONG`,requestId:v});return}case`PM_SET_TRANSACTION_VIEW`:{let e=r.request.payload,t=e&&typeof e==`object`?Reflect.get(e,`requestId`):null,n=e&&typeof e==`object`?Reflect.get(e,`view`):null;typeof t==`string`&&(n===`toast`||n===`closed`)&&(await import(`./transaction-activity-BXSxMp1E.js`).then(e=>e.o)).setTransactionActivityView(t,n);return}case`PM_TRANSACTION_BROADCAST_STARTED`:{let e=r.request.payload,t=e&&typeof e==`object`?Reflect.get(e,`signedTransaction`):null;typeof t==`string`&&(await import(`./transaction-activity-BXSxMp1E.js`).then(e=>e.o)).transactionBroadcastStarted(t);return}}if(!X(r.kind,e.supportedRuntimeRouteKinds)){g({type:`ERROR`,requestId:v,payload:{code:`unsupported_request`,message:`Unsupported wallet iframe request type: ${r.type}`}});return}if(v&&f.add(v),!m&&R(r)&&await V()&&!m){if(E!==h.executionGeneration||C(v))return;D({type:`PM_RESULT`,requestId:v,payload:{ok:!0,result:z(r)}});return}m=!0;let p=await oe(r);if(E!==h.executionGeneration)return;k=`runtime`,await p.handleWalletHostRuntimeRequest({transactionReview:O,state:h,executionGeneration:E,req:r.request,post:Z.bind(null,h,E,g),isCancelled:Q.bind(null,h,E,b),respondIfCancelled:Q.bind(null,h,E,C)})}catch(e){if(E!==h.executionGeneration&&l.type!==`PM_SET_CONFIG`||O?.cancelled)return;if(k===`admission`&&(l.type===`PM_SIGN_AND_SEND_TX`||l.type===`PM_SEND_TRANSACTION`)){D({type:`PM_RESULT`,requestId:v,payload:{ok:!0,result:_(e,`not_submitted`)}});return}let t=await import(`./canonicalSignerErrorCode-CX5PBpkt.js`);if(E!==h.executionGeneration&&l.type!==`PM_SET_CONFIG`)return;let n=e&&typeof e==`object`&&`code`in e?e.code:void 0,r=ae(e),i=t.resolveWalletBoundaryErrorCode({requestType:l.type,rawCode:n,message:r,defaultCode:`HOST_ERROR`}),a=t.resolveWalletBoundaryErrorMessage({requestType:l.type,rawCode:n,code:i,message:r}),o=t.resolveWalletBoundarySignerKind(l.type);g({type:`ERROR`,requestId:v,payload:{code:i,message:a,...t.isWalletSignerBoundaryRequestType(l.type)&&t.isCanonicalSignerSessionBoundaryCode(i)&&o?{signerKind:o}:{}}})}finally{T&&(p.delete(v),f.delete(v),x(v)),O?.finish()}};window.addEventListener(`message`,e=>{let t=_e(e.data),n=e.ports[0];if(!(!t||!n||h.port)){if(e.source!==window.parent||!ve(e.origin)){J(n);return}if(!Y(n,t.payload.protocolVersion)){typeof e.origin==`string`&&e.origin.length&&e.origin!==`null`&&(h.parentOrigin=e.origin),h.port=n;try{h.port.onmessage=T,h.port.start?.()}catch{}g({type:`READY`,payload:{protocolVersion:v}})}}})}try{$()}catch(e){console.error(`[WalletHost] init failed`,e)}export{$ as t};
1
+ import{g as e,h as t}from"./digests-BIaE0DMd.js";import{n}from"./walletRegistrationSetupPrewarm-CEvGKQSg.js";import{t as r}from"./walletDbName-B6-CV_Rq.js";import{n as i,r as a,t as o}from"./configuration-BAad7ngq.js";import{a as ee,i as s,n as te,o as ne,r as re,t as c}from"./transactionReview-CGIlI835.js";import{t as l}from"./events-D6l0_ugy.js";import{i as u,n as d,t as ie}from"./transactionReviewAdmission-Cf_qUZJt.js";import{A as f,D as p,S as m,T as h,d as g,f as _,h as v,k as y,m as b,o as x,t as S,u as C,x as w,y as T}from"./ownerNearOperation-BsIdSH0C.js";import{t as E}from"./walletIframeIdentity-Cz82I_Uh.js";import{t as ae}from"./errors-BJBDbwHk.js";import{s as D}from"./ed25519OperationFingerprint-Dev4P6Og.js";function O(){let e=globalThis;e.global===void 0&&(e.global=globalThis),!e.process||typeof e.process!=`object`?e.process={env:{}}:(!e.process.env||typeof e.process.env!=`object`)&&(e.process.env={})}function k(){O(),window.location.origin===`null`&&(window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`),console.warn(`[WalletHost] iframe is running with opaque (null) origin. Check COEP/CORP headers and ensure navigation succeeded.`)),A(),window.parent?.postMessage({type:`SERVICE_HOST_BOOTED`},`*`),window.parent?.postMessage({type:`SERVICE_HOST_DEBUG_ORIGIN`,origin:window.location.origin,href:window.location.href},`*`);let e=new URL(import.meta.url),t=e.searchParams.get(`v`);t&&y(t);let n=new URL(`.`,e).toString(),r=n.endsWith(`/`)?n:n+`/`;p()||f(r)}function A(){let e=()=>{let e=document;e.documentElement.classList.add(`seams-transparent`),e.body?.classList.add(`seams-transparent`),e.documentElement.classList.remove(`dark`),e.body?.classList.remove(`dark`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e(),window.addEventListener(`load`,()=>e(),{once:!0})}const j={};let M=null,N=null;function oe(e){return e.request.type===`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`?e.request.payload?.authorization?.kind===`email_otp`?P(e.kind):(M??=import(`./runtime-recovery-codes-CFOWDVd9.js`),M):P(e.kind)}function se(){P(`auth`).catch(ce)}function ce(){}function P(e){let t=j[e];if(t)return t;let n=I(e);return j[e]=n,n.catch(le.bind(null,e,n)),n}function le(e,t){j[e]===t&&delete j[e]}async function F(){M??=import(`./runtime-recovery-codes-CFOWDVd9.js`),N??=Promise.all([M,import(`./mountRecoveryCodeBackupSurface-CMtByh-L.js`)]).then(()=>void 0),await N}function I(e){switch(e){case`auth`:return import(`./runtime-auth-CJCU2yJi.js`);case`near`:return import(`./runtime-near-CT2ALBct.js`);case`ecdsa`:return import(`./runtime-ecdsa-tempo-BC8u9NuI.js`);case`email_otp`:return import(`./runtime-email-otp-Cl4iu0z7.js`);case`recovery`:return import(`./runtime-recovery-n-TGLkwz.js`);case`export`:return import(`./runtime-export-BdhfErGJ.js`);case`device_link`:return import(`./runtime-device-link-C0oXLSnz.js`);case`preferences`:return import(`./runtime-preferences-fN2G9tct.js`)}return L(e)}function L(e){throw Error(`Unhandled wallet host runtime route: ${String(e)}`)}function R(e){switch(e.type){case`PM_GET_RECENT_UNLOCKS`:case`PM_GET_CONFIRMATION_CONFIG`:return!0;case`PM_GET_EXACT_WALLET_SESSION_STATE`:{let t=e.request.payload;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`authenticationRead`),r=Reflect.get(t,`wallet`);return(n===`restore`||n===`current`)&&!!r&&typeof r==`object`&&Reflect.get(r,`kind`)===`current`}default:return!1}}function z(e){switch(e.type){case`PM_GET_EXACT_WALLET_SESSION_STATE`:return{revision:C(),walletId:null,state:{kind:`wallet_locked`},session:g()};case`PM_GET_RECENT_UNLOCKS`:return{walletIds:[],accountIds:[],accounts:[],lastUsedAccount:null};case`PM_GET_CONFIRMATION_CONFIG`:return{walletId:null,confirmationConfig:D,revision:0}}}let B=null;function V(){return B??=U().finally(H),B}function H(){B=null}async function U(){try{return typeof indexedDB>`u`||typeof indexedDB.databases!=`function`?!1:(await indexedDB.databases()).some(ue)?await de():!0}catch{return!1}}function ue(e){return e.name===r}function de(){return new Promise(e=>{let t=indexedDB.open(r);t.onupgradeneeded=()=>t.transaction?.abort(),t.onerror=()=>e(!1),t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>n.close(),fe(n).then(t=>{n.close(),e(t===0)},()=>{n.close(),e(!1)})}})}function fe(e){let t=Array.from(e.objectStoreNames);return t.length===0?Promise.resolve(0):new Promise((n,r)=>{let i=e.transaction(t,`readonly`),a=0;for(let e of t){let t=i.objectStore(e).count();t.onsuccess=()=>{a+=t.result}}i.oncomplete=()=>n(a),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)})}function pe(e){throw Error(`Unhandled wallet host route: ${String(e)}`)}function W(e,t){if(e===null)throw Error(`Invalid ${t} payload`);return e}function G(e){try{return E(e)}catch{throw Error(`Hosted auth-menu request requires a non-empty requestId`)}}function me(e){switch(e.type){case`PM_ACTIVATE_TRANSACTION_REVIEW`:case`PING`:case`PM_PREPARE_WALLET_RUNTIME`:case`PM_SET_CONFIG`:case`PM_CANCEL`:case`PM_SET_TRANSACTION_VIEW`:case`PM_TRANSACTION_BROADCAST_STARTED`:return{kind:`boot`,type:e.type,request:e};case`PM_OWNER_NEAR_TRANSACTION`:return{kind:`near`,type:e.type,request:{type:e.type,requestId:E(e.requestId),payload:S(e.payload)}};case`PM_REGISTER_WALLET`:case`PM_ADD_WALLET_SIGNER`:case`PM_ADD_PASSKEY`:case`PM_ACTIVATE_AUTH_METHOD`:case`PM_GET_AUTH_METHOD_AVAILABILITY`:case`PM_SET_AUTH_METHOD_ENABLED`:case`PM_ADD_EMAIL_OTP`:case`PM_REVOKE_AUTH_METHOD`:case`PM_GET_NEAR_PROVISIONING_STATE`:case`PM_SIGN_TX_WITH_ACTIONS`:case`PM_SIGN_AND_SEND_TX`:case`PM_SEND_TRANSACTION`:case`PM_SIGN_DELEGATE_ACTION`:case`PM_SIGN_NEP413`:return{kind:`near`,type:e.type,request:e};case`PM_OPEN_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(m(e.payload),`hosted auth-menu open`)}}}case`PM_CANCEL_AUTH_MENU`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(T(e.payload),`hosted auth-menu cancellation`)}}}case`PM_RESOLVE_WALLET_CONNECTION`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(h(e.payload),`wallet connection resolution`)}}}case`PM_RESOLVE_AUTH_MENU_EXTERNAL_AUTH`:{let t=G(e.requestId);return{kind:`auth`,type:e.type,request:{...e,requestId:t,payload:W(w(e.payload),`hosted auth-menu external-auth resolution`)}}}case`PM_EXTERNAL_OWNER_AUTH`:{let t=x(e.payload);if(t.action!==`associate`&&t.action!==`unlink`)throw Error(`Owner request is invalid`);return{kind:`auth`,type:e.type,request:{type:e.type,requestId:E(e.requestId),payload:t,options:e.options}}}case`PM_UNLOCK`:case`PM_UNLOCK_AUTH_METHOD`:case`PM_EXTERNAL_AUTH`:case`PM_LOCK`:case`PM_LOCK_EXACT_WALLET_SESSION`:case`PM_GET_LAST_WALLET_MOVE_REQUEST`:case`PM_MOVE_WALLET`:case`PM_GET_WALLET_MOVE`:case`PM_GET_WALLET_PLACEMENT`:case`PM_GET_WALLET_SESSION`:case`PM_GET_EXACT_WALLET_SESSION_STATE`:case`PM_GET_RECENT_UNLOCKS`:return{kind:`auth`,type:e.type,request:e};case`PM_SIGN_TEMPO`:case`PM_REPORT_TEMPO_BROADCAST_ACCEPTED`:case`PM_REPORT_TEMPO_BROADCAST_REJECTED`:case`PM_REPORT_TEMPO_FINALIZED`:case`PM_REPORT_TEMPO_DROPPED_OR_REPLACED`:case`PM_RECONCILE_TEMPO_NONCE_LANE`:return{kind:`ecdsa`,type:e.type,request:e};case`PM_REDEEM_HOSTED_WALLET_SEAMS_SESSION`:case`PM_REQUEST_EMAIL_OTP_CHALLENGE`:case`PM_BEGIN_GOOGLE_EMAIL_OTP_WALLET_AUTH`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_RESEND`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_REROLL_WALLET_ID`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_SUBMIT`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_COMPLETE_REGISTRATION`:case`PM_GOOGLE_EMAIL_OTP_WALLET_AUTH_CANCEL`:case`PM_GET_WALLET_RECOVERY_CODE_STATUS`:case`PM_ACKNOWLEDGE_WALLET_RECOVERY_CODE_BACKUP`:case`PM_ROTATE_WALLET_RECOVERY_CODES`:case`PM_REQUEST_WALLET_CUSTODY_EMAIL_OTP_CHALLENGE`:return{kind:`email_otp`,type:e.type,request:e};case`PM_SYNC_ACCOUNT_FLOW`:return{kind:`recovery`,type:e.type,request:e};case`PM_RESOLVE_EXACT_KEY_EXPORT_LANE`:case`PM_EXPORT_KEYPAIR_UI`:return{kind:`export`,type:e.type,request:e};case`PM_HAS_PASSKEY`:case`PM_LIST_LINKED_DEVICES`:case`PM_REVOKE_LINKED_DEVICE`:case`PM_SCAN_AND_LINK_DEVICE`:case`PM_START_DEVICE2_LINKING_FLOW`:case`PM_DEVICE_LINK_TARGET_FACTOR_ACTION`:case`PM_DEVICE_LINK_EMAIL_OTP_BASE_FACTOR_ACTION`:case`PM_CANCEL_DEVICE_LINKING`:return{kind:`device_link`,type:e.type,request:e};case`PM_SET_CONFIRM_BEHAVIOR`:case`PM_SET_CONFIRMATION_CONFIG`:case`PM_GET_CONFIRMATION_CONFIG`:return{kind:`preferences`,type:e.type,request:e}}return pe(e)}function he(e){return e.kind!==`boot`}let K=!1;const ge=[{selector:`.seams-auth-menu-surface`,cancellationKind:`native_cancel`},{selector:`.seams-confirmation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-auth-method-activation-surface`,cancellationKind:`native_cancel`},{selector:`.seams-export-surface`,cancellationKind:`wallet_iframe_cancel`},{selector:`[data-seams-wallet-recovery-backup-dialog]`,cancellationKind:`native_cancel`}];function q(e,t){let n=new Set(t),r=Object.keys(e);return r.length===t.length&&r.every(e=>n.has(e))}function _e(t){return!e(t)||!q(t,[`type`,`payload`])||t.type!==`CONNECT`||!e(t.payload)||!q(t.payload,[`protocolVersion`])?null:typeof t.payload.protocolVersion==`string`?{type:`CONNECT`,payload:{protocolVersion:t.payload.protocolVersion}}:null}function ve(e){if(e===`null`)return!0;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.origin===e}catch{return!1}}function J(e){try{e.close()}catch{}}function Y(e,t){if(t===`21.0.0`)return!1;let n={expectedProtocolVersion:v,receivedProtocolVersion:t};try{e.postMessage({type:`ERROR`,payload:{code:b,message:`Wallet iframe protocol version mismatch: expected ${v}, received ${t??`missing`}`,details:n}})}catch{}return J(e),!0}function X(e,t){return!t||t.has(e)}function Z(e,t,n,r){e.executionGeneration===t&&n(r)}function ye(e,t,n,r){if(t===`PM_SIGN_AND_SEND_TX`){e({type:`PM_RESULT`,requestId:n,payload:{ok:!0,result:_(r,`not_submitted`)}});return}e({type:`ERROR`,requestId:n,payload:{code:r instanceof c?r.code:`cancelled`,message:r.message}})}function Q(e,t,n,r){return e.executionGeneration!==t||n(r)}function $(e={}){if(K)return;K=!0,k(),(!e.supportedRuntimeRouteKinds||e.supportedRuntimeRouteKinds.has(`email_otp`))&&F().catch(()=>void 0);let r=new Set,f=new Set,p=new Set,m=!1,h={parentOrigin:null,port:null,configuration:{kind:`unconfigured`},executionGeneration:0,onConfigurationChanged:null},g=e=>{try{h.port?.postMessage(e)}catch{}},y=e=>{e&&r.add(e)},b=e=>!!e&&(r.has(e)||u(e)?.cancelled===!0),x=e=>{e&&r.delete(e)},S=e=>{e&&g({type:`ERROR`,requestId:e,payload:{code:`cancelled`,message:`Request cancelled`}})},C=e=>!e||!b(e)?!1:u(e)?.cancelled?!0:(S(e),x(e),!0),w=()=>{for(let e of ge){let t=document.querySelectorAll(e.selector);for(let n of t)try{e.cancellationKind===`native_cancel`?n.dispatchEvent(new Event(`cancel`,{cancelable:!0})):n.dispatchEvent(new CustomEvent(l.TX_CONFIRMER_CANCEL,{bubbles:!0,composed:!0}))}catch{}}},T=async r=>{let l=r.data;if(!l||!t(l))return;let v=l.requestId,T=typeof v==`string`&&l.type!==`PM_CANCEL`;if(T){if(p.has(v)){g({type:`ERROR`,requestId:v,payload:{code:`request_in_progress`,message:`Request identity is already active`}});return}p.add(v)}let E=h.executionGeneration,D=Z.bind(null,h,E,g),O=null,k=`admission`;try{let t=l.type.startsWith(`PM_SIGN_`)?await(await import(`./runtimeContext-DI28d8Qu.js`)).walletAuthMethodReviewPolicy(h,l):{kind:`disabled`};if(h.executionGeneration!==E||b(v))return;if(`transactionReview`in l){if(l.type!==`PM_SIGN_AND_SEND_TX`&&l.type!==`PM_SIGN_TEMPO`)throw new c(`review_invalid_input`,`Review is unsupported for this request`);let e=s(l.transactionReview);if(e.requestId!==v)throw new c(`review_invalid_input`,`Review request identity mismatch`);let n=l.payload?.options?.confirmationConfig;if(n?.uiMode!==`modal`||n.behavior!==`requireClick`)throw new c(`review_unsupported_mode`,`Review requires modal presentation and explicit approval`);O=new ie(e,l.type===`PM_SIGN_TEMPO`&&l.payload?.request.senderSignatureAlgorithm!==`secp256k1`?`credential`:`mpc`,e=>D({type:`TRANSACTION_REVIEW_STATE`,requestId:v,payload:e}),ye.bind(null,D,l.type,v),t)}(l.type===`PM_LOCK`||l.type===`PM_LOCK_EXACT_WALLET_SESSION`)&&d(new c(`review_identity_changed`,`The wallet session changed`));let r=me(l);if(!he(r))switch(r.type){case`PING`:g({type:`PONG`,requestId:v});return;case`PM_PREPARE_WALLET_RUNTIME`:X(`auth`,e.supportedRuntimeRouteKinds)&&se(),g({type:`PONG`,requestId:v});return;case`PM_SET_CONFIG`:{let e=o(h.configuration,i(r.request.payload)),t=a(h.configuration.kind===`configured`?h.configuration.config:null)!==a(e.config);if(h.configuration=e,t){h.executionGeneration+=1;let t=e.config;t.registration.publishableKey&&t.registration.projectEnvironmentId&&n(t.network.relayer.url);for(let e of f)g({type:`ERROR`,requestId:e,payload:{code:`wallet_configuration_changed`,message:`Wallet configuration changed during request`}});f.clear()}h.onConfigurationChanged?.(),t&&(d(new c(`review_identity_changed`,`Wallet execution configuration changed`)),w()),g({type:`PONG`,requestId:v});return}case`PM_ACTIVATE_TRANSACTION_REVIEW`:{let e=re(r.request.payload);e&&u(e.requestId)?.activate(e);return}case`PM_CANCEL`:{let e=r.request.payload?.requestId,t=r.request.payload,n=t&&typeof t==`object`?Reflect.get(t,`transactionReview`):void 0;if(n!==void 0){let r=s(n),i=u(r.requestId);if(r.requestId===e&&i&&ee(r,i.metadata)){let e=new c(ne(t&&typeof t==`object`?Reflect.get(t,`reviewErrorCode`):void 0),`Reviewed request cancelled`);try{te(i.metadata.validity)}catch(t){t instanceof Error&&(e=t)}i.cancel(e)}g({type:`PONG`,requestId:v});return}let i=e?u(e):void 0;if(i){i.cancel(new c(`cancelled`,`Request cancelled`)),g({type:`PONG`,requestId:v});return}y(e),(await import(`./deviceLinkApproval-C4T8XAmi.js`).then(e=>e.i)).cancelDeviceLinkApproval(typeof e==`string`?{kind:`request`,requestId:e}:{kind:`all`}),w(),e&&S(e),g({type:`PONG`,requestId:v});return}case`PM_SET_TRANSACTION_VIEW`:{let e=r.request.payload,t=e&&typeof e==`object`?Reflect.get(e,`requestId`):null,n=e&&typeof e==`object`?Reflect.get(e,`view`):null;typeof t==`string`&&(n===`toast`||n===`closed`)&&(await import(`./transaction-activity-BXSxMp1E.js`).then(e=>e.o)).setTransactionActivityView(t,n);return}case`PM_TRANSACTION_BROADCAST_STARTED`:{let e=r.request.payload,t=e&&typeof e==`object`?Reflect.get(e,`signedTransaction`):null;typeof t==`string`&&(await import(`./transaction-activity-BXSxMp1E.js`).then(e=>e.o)).transactionBroadcastStarted(t);return}}if(!X(r.kind,e.supportedRuntimeRouteKinds)){g({type:`ERROR`,requestId:v,payload:{code:`unsupported_request`,message:`Unsupported wallet iframe request type: ${r.type}`}});return}if(v&&f.add(v),!m&&R(r)&&await V()&&!m){if(E!==h.executionGeneration||C(v))return;D({type:`PM_RESULT`,requestId:v,payload:{ok:!0,result:z(r)}});return}m=!0;let p=await oe(r);if(E!==h.executionGeneration)return;k=`runtime`,await p.handleWalletHostRuntimeRequest({transactionReview:O,state:h,executionGeneration:E,req:r.request,post:Z.bind(null,h,E,g),isCancelled:Q.bind(null,h,E,b),respondIfCancelled:Q.bind(null,h,E,C)})}catch(e){if(E!==h.executionGeneration&&l.type!==`PM_SET_CONFIG`||O?.cancelled)return;if(k===`admission`&&(l.type===`PM_SIGN_AND_SEND_TX`||l.type===`PM_SEND_TRANSACTION`)){D({type:`PM_RESULT`,requestId:v,payload:{ok:!0,result:_(e,`not_submitted`)}});return}let t=await import(`./canonicalSignerErrorCode-CX5PBpkt.js`);if(E!==h.executionGeneration&&l.type!==`PM_SET_CONFIG`)return;let n=e&&typeof e==`object`&&`code`in e?e.code:void 0,r=ae(e),i=t.resolveWalletBoundaryErrorCode({requestType:l.type,rawCode:n,message:r,defaultCode:`HOST_ERROR`}),a=t.resolveWalletBoundaryErrorMessage({requestType:l.type,rawCode:n,code:i,message:r}),o=t.resolveWalletBoundarySignerKind(l.type);g({type:`ERROR`,requestId:v,payload:{code:i,message:a,...t.isWalletSignerBoundaryRequestType(l.type)&&t.isCanonicalSignerSessionBoundaryCode(i)&&o?{signerKind:o}:{}}})}finally{T&&(p.delete(v),f.delete(v),x(v)),O?.finish()}};window.addEventListener(`message`,e=>{let t=_e(e.data),n=e.ports[0];if(!(!t||!n||h.port)){if(e.source!==window.parent||!ve(e.origin)){J(n);return}if(!Y(n,t.payload.protocolVersion)){typeof e.origin==`string`&&e.origin.length&&e.origin!==`null`&&(h.parentOrigin=e.origin),h.port=n;try{h.port.onmessage=T,h.port.start?.()}catch{}g({type:`READY`,payload:{protocolVersion:v}})}}})}try{$()}catch(e){console.error(`[WalletHost] init failed`,e)}export{$ as t};
@@ -0,0 +1 @@
1
+ import{E as e,k as t}from"./domainIds-t1lp25yU.js";import{S as n,b as r,g as i,x as a}from"./digests-BIaE0DMd.js";import{N as o,r as s}from"./activeWalletSession-HAOgRKzn.js";import{t as c}from"./walletIframeIdentity-Cz82I_Uh.js";import{r as l}from"./canonicalPrimitives-DKeS3M40.js";import{o as u}from"./errors-BJBDbwHk.js";import{s as d}from"./nearRpcResults-CeHdqaS4.js";import{n as f}from"./ed25519OperationFingerprint-Dev4P6Og.js";import{r as p}from"./types-D2Zk1W7I.js";import{t as m}from"./accountIds-DGWFzEnw.js";import{t as h}from"./actions-7SvZZut1.js";const g=`__SEAMS_WALLET_SDK_BASE__`,_=`SEAMS_WALLET_SDK_BASE_CHANGED`,v=`__SEAMS_WALLET_ASSET_VERSION__`;function y(){if(typeof window>`u`)return;let e=window[g];return typeof e==`string`&&e.length>0?e:void 0}function ee(e){if(typeof window>`u`)return;let t=window;t[g]=e,window.dispatchEvent(new CustomEvent(_,{detail:e}))}function te(){if(typeof window>`u`)return;let e=window[v];return typeof e==`string`&&e.length>0?e:void 0}function ne(e){if(typeof window>`u`)return;let t=e.trim();t&&(window[v]=t)}function re(e){if(typeof window>`u`)return()=>{};let t=t=>{let n=t.detail;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(_,t,{passive:!0}),()=>window.removeEventListener(_,t)}function b(e){let t=ie(e);if(t!==null)return t;if(typeof e!=`string`||e.length>131072)return null;try{return new URL(e).protocol===`https:`?e:null}catch{return null}}function ie(e){return typeof e!=`string`||e.length>131072||!/^data:image\/(?:png|webp|jpeg|svg\+xml)[;,]/i.test(e)?null:e}function ae(e){if(e===void 0)return`collapsible`;switch(e){case`collapsible`:return`collapsible`;case`expanded`:return`expanded`;case`hidden`:return`hidden`;default:return null}}function oe(e){if(e===void 0)return{kind:`seams`};if(!i(e))return null;if(e.kind===`seams`&&Object.keys(e).length===1)return{kind:`seams`};if(e.kind!==`custom`||Object.keys(e).length!==3||typeof e.name!=`string`||!e.name.trim()||e.name.length>512)return null;let t=b(e.logo);return t?{kind:`custom`,logo:t,name:e.name.trim()}:null}function x(){return{primary:[],secondary:[]}}function S(e){return typeof e==`string`&&e.trim().length>0&&e.length<=512}function se(e){if(e===null)return{ok:!0,value:null};let t=b(e);return t===null?{ok:!1}:{ok:!0,value:t}}function C(e,t){if(!Array.isArray(e)||e.length>32)return null;let n=[];for(let r of e){if(!i(r)||!S(r.id)||!S(r.label)||typeof r.description!=`string`||r.description.length>512||t.has(r.id))return null;let e=se(r.icon);if(!e.ok)return null;t.add(r.id),n.push({id:r.id,label:r.label,description:r.description,icon:e.value})}return n}function ce(e){if(!i(e))return null;let t=new Set,n=C(e.primary,t),r=C(e.secondary,t);return n&&r?{primary:n,secondary:r}:null}function le(e){if(!i(e)||!i(e.result))return null;let t=k(e.authMenuSessionId),n;try{n=c(e.requestId)}catch{return null}if(!t||!S(e.connectionRequestId))return null;let r;switch(e.result.kind){case`connected`:case`cancelled`:if(e.result.message!==void 0)return null;r={kind:e.result.kind};break;case`failed`:if(!S(e.result.message))return null;r={kind:`failed`,message:e.result.message};break;default:return null}return{authMenuSessionId:t,requestId:n,connectionRequestId:e.connectionRequestId,result:r}}const w={login:{title:`Welcome back`,subtitle:``,passkeyCta:`Unlock with passkey`},register:{title:`Create a wallet`,subtitle:``,passkeyNameLabel:`Wallet name`,passkeyCta:`Create wallet with passkey`},common:{closeLabel:`Close`}};function T(e,t){return typeof e==`string`&&e.trim()||null}function E(e,t){let n=T(e,t);return n===null?null:n}function D(e){try{return c(e)}catch{return null}}function O(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function k(e){return E(e,`authMenuSessionId`)}function A(e){return E(e,`externalAuthRequestId`)}function j(e){return i(e)?e:null}function M(e,t=new Set,n=!1){if(e===void 0)return n;if(e===null||typeof e==`string`||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>M(e,t,n));let r=j(e);return r!==null&&Object.values(r).every(e=>M(e,t,n))}function N(e,t){return T(e,`copy`)??t}function P(e,t){let n=j(e);return{title:N(n?.title,t.title),subtitle:N(n?.subtitle,t.subtitle),passkeyCta:N(n?.passkeyCta,t.passkeyCta)}}function F(e){let t=j(e),n=j(t?.register);return{login:P(t?.login,w.login),register:{...P(t?.register,w.register),passkeyNameLabel:N(n?.passkeyNameLabel,w.register.passkeyNameLabel)},common:{closeLabel:N(j(t?.common)?.closeLabel,w.common.closeLabel)}}}function I(e){return e===`google`?e:null}function L(e){return e===`login`||e===`register`?e:null}function R(e){return e===`implicit_wallet`||e===`sponsored_named_near_account`?e:null}function z(e){return e===`close_button`||e===`component_unmounted`||e===`connection_closed`?e:null}function B(e,t){if(e===void 0)return!0;let n=j(e);return n!==null&&O(n,t)}function V(e){let t=j(e);return!t||!O(t,[`login`,`register`,`common`])?!1:B(t.login,[`title`,`subtitle`,`passkeyCta`])&&B(t.register,[`title`,`subtitle`,`passkeyCta`,`passkeyNameLabel`])&&B(t.common,[`closeLabel`])}function H(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=I(n);if(!e)return null;t.push(e)}return t}function U(e){let n=j(e);if(!n||!M(n,new Set,!0)||n.kind!==`hosted_auth_menu_open_v1`||!O(n,[`kind`,`authMenuSessionId`,`initialMode`,`initialHeightCssPx`,`loginTarget`,`registrationAccountInput`,`showRegistrationInput`,`showProgress`,`copy`,`enabledExternalProviders`,`walletAlternatives`,`recoveryOptions`,`footerBrand`])||!V(n.copy))return null;let r=k(n.authMenuSessionId),i=L(n.initialMode),a=n.initialHeightCssPx;if(a!==void 0&&(typeof a!=`number`||!Number.isFinite(a)||a<=0))return null;let o=j(n.loginTarget),s=o?.kind===`wallet`||o?.kind===`wallet_sync`?t(o.walletId):null,c=o?.kind===`discoverable`&&O(o,[`kind`])?{kind:`discoverable`}:o?.kind===`wallet`&&O(o,[`kind`,`walletId`])&&s?.ok?{kind:`wallet`,walletId:s.value}:o?.kind===`wallet_sync`&&O(o,[`kind`,`walletId`])&&s?.ok?{kind:`wallet_sync`,walletId:s.value}:null,l=R(n.registrationAccountInput),u=H(n.enabledExternalProviders),d=ae(n.recoveryOptions),f=oe(n.footerBrand),p=n.walletAlternatives===void 0?x():ce(n.walletAlternatives);return!r||!i||!c||!l||typeof n.showRegistrationInput!=`boolean`||typeof n.showProgress!=`boolean`||!u||!p||!d||!f||!M(n.copy,new Set,!0)?null:{kind:`hosted_auth_menu_open_v1`,authMenuSessionId:r,initialMode:i,initialHeightCssPx:a,loginTarget:c,registrationAccountInput:l,showRegistrationInput:n.showRegistrationInput,showProgress:n.showProgress,copy:F(n.copy),enabledExternalProviders:u,walletAlternatives:p,recoveryOptions:d,footerBrand:f}}function W(e){let t=j(e);if(!t||!M(t)||t.kind!==`hosted_auth_menu_error_v1`||!O(t,[`kind`,`authMenuSessionId`,`mode`,`message`]))return null;let n=k(t.authMenuSessionId),r=L(t.mode),i=T(t.message,`message`);return n&&r&&i?{kind:t.kind,authMenuSessionId:n,mode:r,message:i}:null}function ue(e){let t=j(e);if(!t||!M(t))return null;switch(t.kind){case`google_id_token`:{if(!O(t,[`kind`,`idToken`]))return null;let e=T(t.idToken,`idToken`);return e?{kind:t.kind,idToken:e}:null}case`cancelled`:return O(t,[`kind`,`reason`])&&t.reason===`user_cancelled`?{kind:t.kind,reason:t.reason}:null;case`failed`:{if(!O(t,[`kind`,`code`,`message`]))return null;let e=t.code===`provider_unavailable`||t.code===`provider_error`||t.code===`invalid_evidence`?t.code:null,n=T(t.message,`message`);return e&&n?{kind:t.kind,code:e,message:n}:null}default:return null}}function de(e){let t=j(e);if(!t||!M(t)||t.kind!==`hosted_auth_menu_external_auth_resolution_v1`||!O(t,[`kind`,`authMenuSessionId`,`externalAuthRequestId`,`requestId`,`evidence`]))return null;let n=k(t.authMenuSessionId),r=A(t.externalAuthRequestId),i=D(t.requestId),a=ue(t.evidence);return!n||!r||!i||!a?null:{kind:t.kind,authMenuSessionId:n,externalAuthRequestId:r,requestId:i,evidence:a}}function fe(e){let t=j(e);if(!t||!M(t)||t.kind!==`hosted_auth_menu_cancel_v1`||!O(t,[`kind`,`authMenuSessionId`,`requestId`,`reason`]))return null;let n=k(t.authMenuSessionId),r=D(t.requestId),i=z(t.reason);return n&&r&&i?{kind:t.kind,authMenuSessionId:n,requestId:r,reason:i}:null}const pe=`21.0.0`,me=`WALLET_IFRAME_PROTOCOL_VERSION_MISMATCH`,G=[`home`,`exchangeCode`,`nonce`,`appOrigin`,`walletOrigin`,`relayUrl`];function K(e,t){if(typeof e!=`string`||e.length===0||e.length>512||e.trim()!==e||/[\s\u0000-\u001f\u007f]/.test(e))throw Error(`${t} must be a compact opaque identifier`);return e}function q(e,t){if(typeof e!=`string`||e.length===0||e.trim()!==e)throw Error(`${t} must be a canonical HTTP origin`);let n;try{n=new URL(e)}catch{throw Error(`${t} must be a canonical HTTP origin`)}if(n.protocol!==`https:`&&n.protocol!==`http:`||n.origin!==e||n.pathname!==`/`||n.search!==``||n.hash!==``)throw Error(`${t} must be a canonical HTTP origin`);return n.origin}function he(e){if(!i(e))throw Error(`hosted-wallet redemption payload must be an exact object`);if(Object.keys(e).length!==G.length)throw Error(`hosted-wallet redemption payload fields are invalid`);for(let t of G)if(!Object.hasOwn(e,t))throw Error(`hosted-wallet redemption payload fields are invalid`);return{home:s(e.home),exchangeCode:K(e.exchangeCode,`exchangeCode`),nonce:K(e.nonce,`nonce`),appOrigin:q(e.appOrigin,`appOrigin`),walletOrigin:q(e.walletOrigin,`walletOrigin`),relayUrl:K(e.relayUrl,`relayUrl`)}}function ge(t){if(!i(t)||!O(t,[`scanRequestId`,`action`])||typeof t.scanRequestId!=`string`||t.scanRequestId.length===0||!i(t.action))return null;let n=t.action;if(n.kind===`cancel`)return O(n,[`kind`])?{scanRequestId:t.scanRequestId,action:{kind:n.kind}}:null;if(n.kind!==`select`||!O(n,[`kind`,`baseWalletAuthMethodId`]))return null;let r=e(n.baseWalletAuthMethodId);return r.ok?{scanRequestId:t.scanRequestId,action:{kind:n.kind,baseWalletAuthMethodId:r.value}}:null}function _e(e){if(!i(e)||!O(e,[`activationId`,`action`])||typeof e.activationId!=`string`||e.activationId.length===0||!i(e.action))return null;let t=e.action;switch(t.kind){case`create_passkey`:case`send_email_otp`:case`resend_email_otp`:return O(t,[`kind`])?{activationId:e.activationId,action:{kind:t.kind}}:null;case`submit_email_otp`:return O(t,[`kind`,`otpCode`])&&typeof t.otpCode==`string`&&/^\d{6}$/.test(t.otpCode)?{activationId:e.activationId,action:{kind:t.kind,otpCode:t.otpCode}}:null;default:return null}}function ve(e){let t=n(e,`NEAR transaction result`);if(t.success===!0){let e=r(t.transactionId,`transactionId`),n=d(t.result);if(e!==n.transaction.hash)throw Error(`NEAR transaction result contains different transaction hashes`);return typeof n.status==`object`&&`Failure`in n.status?J(e,Error(`NEAR transaction execution failed`)):{success:!0,transactionId:e,result:n}}if(t.success!==!1)throw Error(`Invalid NEAR transaction result`);let i=a(t.error,`NEAR transaction error`);switch(t.kind){case`not_submitted`:return{success:!1,kind:`not_submitted`,error:i};case`submission_unknown`:return{success:!1,kind:`submission_unknown`,error:i};case`unresolved`:return{success:!1,kind:`unresolved`,transactionId:r(t.transactionId,`transactionId`),error:i};default:throw Error(`Invalid NEAR transaction failure`)}}function ye(e,t){return{success:!1,kind:t,error:u(e)||`NEAR transaction failed`}}function J(e,t){return{success:!1,kind:`unresolved`,transactionId:e,error:u(t)}}function be(){return{appIdentity:{kind:`anonymous`},authentication:{kind:`signed_out`},capabilityProjection:{kind:`not_requested`},nonceDiagnostics:null}}let Y=0;function xe(){return Y+=1,Y}const Se=`/wallet/external-auth`;function Ce(e){let t=n(e,`external identity`),i=t.provider,a=r(t.issuer,`issuer`),o=r(t.subject,`subject`);switch(i){case`google`:if(a!==`https://accounts.google.com`)throw Error(`Invalid Google issuer`);return{provider:i,issuer:a,subject:o};case`application`:return{provider:i,issuer:a,subject:o};default:throw Error(`Invalid external identity provider`)}}function we(e){let i=n(e,`external owner challenge`),a=t(i.walletId);if(!a.ok)throw Error(`Invalid owner challenge wallet`);let s=a.value,c=r(i.attemptId,`attemptId`),u=Ce(i.identity),d=l(i.challengeB64u),f=o(i.expiresAtMs,`owner challenge expiry`);switch(i.kind){case`associate`:return{kind:`associate`,walletId:s,attemptId:c,identity:u,challengeB64u:d,expiresAtMs:f};case`unlink`:return{kind:`unlink`,walletId:s,attemptId:c,identity:u,challengeB64u:d,expiresAtMs:f,associationId:r(i.associationId,`associationId`)};default:throw Error(`Invalid owner challenge purpose`)}}function Te(e){let t=n(e,`external auth command`);if(t.action===`prepare`||t.action===`prepare_association`)return{action:t.action,walletId:r(t.walletId,`walletId`)};if(t.action===`unlink`)return{action:`unlink`,walletId:r(t.walletId,`walletId`),associationId:r(t.associationId,`associationId`)};if(t.action!==`authenticate`&&t.action!==`associate`)throw Error(`Invalid external authentication command`);let i=n(t.input,`authentication input`),a=r(i.walletId,`walletId`);if(i.method===`google`)return{action:t.action,input:{method:`google`,walletId:a,idToken:r(i.idToken,`idToken`)}};if(i.method===`handoff`)return{action:t.action,input:{method:`handoff`,walletId:a,attemptId:r(i.attemptId,`attemptId`),code:r(i.code,`code`)}};throw Error(`Unsupported external authentication method`)}function X(e){let i=n(e,`external authentication`),a=t(i.walletId);if(!a.ok||i.kind!==`external_authenticated`||i.provider!==`google`&&i.provider!==`application`||i.permission!==`wallet_settings_read`||`authMethod`in i)throw Error(`External authentication is invalid`);return{kind:`external_authenticated`,walletId:a.value,sessionId:r(i.sessionId,`sessionId`),associationId:r(i.associationId,`associationId`),environmentId:r(i.environmentId,`environmentId`),provider:i.provider,permission:`wallet_settings_read`,expiresAtMs:o(i.expiresAtMs,`expiresAtMs`)}}function Z(e){return{ok:!1,code:e,message:`Wallet authentication could not be completed.`}}function Q(e){let t=n(e,`external authentication failure`);switch(t.code){case`invalid_request`:case`invalid_credential`:case`access_denied`:case`expired`:case`superseded`:case`unavailable`:case`rate_limited`:case`cancelled`:return Z(t.code);default:return Z(`unavailable`)}}function Ee(e){let t=n(e,`external settings`);if(!Array.isArray(t.accounts)||!Array.isArray(t.methods)||!Array.isArray(t.devices))throw Error(`Invalid wallet settings`);return{authentication:X(t.authentication),accounts:t.accounts.map(De),methods:t.methods.map(Oe),devices:t.devices.map(ke)}}function De(e){let t=n(e,`account`);if(t.family!==`ed25519`&&t.family!==`ecdsa`)throw Error(`Invalid account family`);return{family:t.family,address:r(t.address,`address`),publicKey:r(t.publicKey,`publicKey`)}}function Oe(e){let t=n(e,`method`);if(t.kind!==`passkey`&&t.kind!==`email_otp`&&t.kind!==`voiceid`)throw Error(`Invalid method`);return{id:r(t.id,`id`),kind:t.kind}}function ke(e){return{id:r(n(e,`device`).id,`id`)}}function $(e){let i=n(e,`owner operation recovery`),a=r(i.operationId,`operationId`);if(!/^owner-near:[A-Za-z0-9_-]{32,64}$/.test(a))throw Error(`Invalid owner operation ID.`);let o=t(i.walletId);if(!o.ok)throw Error(`Invalid owner operation wallet.`);return{operationId:p.signingOperation(a),walletId:o.value,nearAccountId:m(r(i.nearAccountId,`nearAccountId`))}}function Ae(e){let t=n(e,`owner operation command`),r=X(t.authentication),i=$(t.recovery);if(i.walletId!==String(r.walletId))throw Error(`Owner operation wallet mismatch.`);switch(t.action){case`recover`:return{action:`recover`,authentication:r,recovery:i};case`approve`:{let e=n(t.transaction,`transaction`),a=f({nearAccountId:i.nearAccountId,receiverId:e.receiverId,actions:e.actions},`transaction`);if(a.nearAccountId!==String(i.nearAccountId))throw Error(`Owner operation account mismatch.`);let o=t.expiresAtMs;if(typeof o!=`number`||!Number.isSafeInteger(o)||o<=0)throw Error(`Invalid owner operation expiry.`);return{action:`approve`,authentication:r,recovery:i,expiresAtMs:o,transaction:{receiverId:a.receiverId,actions:a.actions.map(Me)}}}default:throw Error(`Invalid owner operation action.`)}}function je(e){let t=n(e,`owner operation outcome`);switch(t.kind){case`completed`:{let e=ve(t.result);if(!e.success)throw Error(`A completed owner operation requires a successful transaction.`);return{kind:`completed`,result:e}}case`reverted`:return{kind:`reverted`,transactionId:r(t.transactionId,`transactionId`),error:r(t.error,`error`)};case`cancelled`:return{kind:`cancelled`};case`expired`:return{kind:`expired`};case`failed`:return{kind:`failed`,error:r(t.error,`error`)};case`unknown`:return{kind:`unknown`,recovery:$(t.recovery)};default:throw Error(`Invalid owner operation outcome.`)}}function Me(e){switch(e.action_type){case`CreateAccount`:return{action_type:h.CreateAccount};case`DeployContract`:return{action_type:h.DeployContract,code:[...e.code]};case`FunctionCall`:return{action_type:h.FunctionCall,method_name:e.method_name,args:e.args,gas:e.gas,deposit:e.deposit};case`Transfer`:return{action_type:h.Transfer,deposit:e.deposit};case`Stake`:return{action_type:h.Stake,stake:e.stake,public_key:e.public_key};case`AddKey`:return{action_type:h.AddKey,public_key:e.public_key,access_key:e.access_key};case`DeleteKey`:return{action_type:h.DeleteKey,public_key:e.public_key};case`DeleteAccount`:return{action_type:h.DeleteAccount,beneficiary_id:e.beneficiary_id};case`DeployGlobalContract`:return{action_type:h.DeployGlobalContract,code:[...e.code],deploy_mode:e.deploy_mode};case`UseGlobalContract`:return e.account_id===void 0?{action_type:h.UseGlobalContract,code_hash:e.code_hash}:{action_type:h.UseGlobalContract,account_id:e.account_id};case`SignedDelegate`:throw Error(`Use the delegate API for delegated actions.`);default:throw Error(`Unsupported owner transaction action.`)}}export{ee as A,he as C,y as D,te as E,re as O,U as S,le as T,ge as _,Z as a,W as b,we as c,be as d,ye as f,A as g,pe as h,Se as i,ne as k,Ee as l,me as m,je as n,Te as o,J as p,$ as r,Q as s,Ae as t,xe as u,_e as v,x as w,de as x,fe as y};