@seams/wallet 0.19.0 → 0.21.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 (381) hide show
  1. package/dist/.build-inputs.sha256 +1 -1
  2. package/dist/esm/SeamsWeb/SeamsWeb.js +2 -2
  3. package/dist/esm/SeamsWeb/operations/recovery/walletRecoveryCodeBackup.js +25 -5
  4. package/dist/esm/SeamsWeb/operations/tempo/executeEvmFamilyTransaction.js +4 -2
  5. package/dist/esm/SeamsWeb/walletIframe/client/router.js +5 -2
  6. package/dist/esm/core/rpcClients/evm/EvmClient.js +11 -9
  7. package/dist/esm/core/signingEngine/flows/signEvmFamily/thresholdAdmission.js +1 -1
  8. package/dist/esm/core/signingEngine/uiConfirm/ui/preact/RecoveryCodeBackupSurface.js +20 -9
  9. package/dist/esm/plugins/SeamsWeb/walletIframe/sanitization.js +18 -0
  10. package/dist/esm/plugins/plugin-utils.js +5 -2
  11. package/dist/esm/react/components/AccountMenuButton/AuthenticationMethodsModal.js +3 -9
  12. package/dist/esm/react/components/AccountMenuButton/LinkedDevicesModal.js +2 -2
  13. package/dist/esm/react/components/AccountMenuButton/index.js +11 -1
  14. package/dist/esm/sdk/{ConfirmationDrawer-DCw0m-Iv.js → ConfirmationDrawer-B7RCp58z.js} +1 -1
  15. package/dist/esm/sdk/{NonceCoordinator-Dq-FZpBz.js → NonceCoordinator-Do23iTzQ.js} +1 -1
  16. package/dist/esm/sdk/accountLifecycle-CXTlwnAS.js +1 -0
  17. package/dist/esm/sdk/activeWalletSession-BtEHhe99.js +1 -0
  18. package/dist/esm/sdk/adapters-La60hveX.js +2 -0
  19. package/dist/esm/sdk/challengeDelivery-C88JNwKf.js +1 -0
  20. package/dist/esm/sdk/clientSessionPersistenceState-DFGHXoKK.js +1 -0
  21. package/dist/esm/sdk/collectAuthenticationCredentialForChallengeB64u-CSwy9csE.js +1 -0
  22. package/dist/esm/sdk/{commitQueue-BW7BpYyA.js → commitQueue-BQPOhyGl.js} +1 -1
  23. package/dist/esm/sdk/{display-WtILOPQR.js → display-Dtugjeya.js} +1 -1
  24. package/dist/esm/sdk/ecdsaCapabilityManifest-B3u6J5gn.js +1 -0
  25. package/dist/esm/sdk/{ecdsaDerivationClientWasm-DmwKWUEb.js → ecdsaDerivationClientWasm-D1HzwUgV.js} +1 -1
  26. package/dist/esm/sdk/ecdsaDerivationExport-DrFESeRP.js +1 -0
  27. package/dist/esm/sdk/ecdsaWalletRecords-BmhuJF1y.js +1 -0
  28. package/dist/esm/sdk/emailOtpEcdsaDerivationIdentity-DreNrM6n.js +1 -0
  29. package/dist/esm/sdk/{enrichDisplayModelWithAbi-DSj4NAlY.js → enrichDisplayModelWithAbi-D0o0IL7_.js} +1 -1
  30. package/dist/esm/sdk/{evmCryptoWasm-DeobzyP-.js → evmCryptoWasm-S2gL5ht4.js} +1 -1
  31. package/dist/esm/sdk/{export-viewer-host-DsdzagKK.js → export-viewer-host-CVdpEuY6.js} +1 -1
  32. package/dist/esm/sdk/exportKeypairOperation-gVCqLrDl.js +1 -0
  33. package/dist/esm/sdk/host-Bz7mRJPZ.js +1 -0
  34. package/dist/esm/sdk/keyMaterialEnvelope-B3v6HLtz.js +1 -0
  35. package/dist/esm/sdk/{lanes-BzU7cv2T.js → lanes-l274pbT5.js} +1 -1
  36. package/dist/esm/sdk/localOnly-TXaYAZj-.js +1 -0
  37. package/dist/esm/sdk/{mountExportPrivateKeySurface-DQzFzhNu.js → mountExportPrivateKeySurface-DUnKOBQr.js} +1 -1
  38. package/dist/esm/sdk/mountRecoveryCodeBackupSurface-MGTl6FhG.js +2 -0
  39. package/dist/esm/sdk/nearEd25519YaoMaterialActivation-BK8_DxHs.js +1 -0
  40. package/dist/esm/sdk/nearEd25519YaoSigningPreparation-BgCxoh9S.js +1 -0
  41. package/dist/esm/sdk/{nonceLaneKeys-BzMBVxMU.js → nonceLaneKeys-CR2XEvnk.js} +1 -1
  42. package/dist/esm/sdk/{normalization-Ct9-AY13.js → normalization-Ctkj80dW.js} +1 -1
  43. package/dist/esm/sdk/{operationFingerprint-C4VX-0NI.js → operationFingerprint-DRPONhBD.js} +1 -1
  44. package/dist/esm/sdk/pendingWalletRecoveryCodeBackup-DWeemdJv.js +1 -0
  45. package/dist/esm/sdk/presignaturePool-DNiA3sgr.js +1 -0
  46. package/dist/{public/sdk/singletons-CAsc9LvA.js → esm/sdk/presignatures-DGLNs29C.js} +1 -1
  47. package/dist/esm/sdk/recovery-entrypoint-CNVjXz6A.js +1 -0
  48. package/dist/esm/sdk/recoveryAuthorization-BplZWc-N.js +1 -0
  49. package/dist/esm/sdk/{registration-DknFwoqn.js → registration-DVX_lnP7.js} +1 -1
  50. package/dist/esm/sdk/registration-DeCUrUR9.js +1 -0
  51. package/dist/esm/sdk/registrationAccounts-BfO6Ztye.js +1 -0
  52. package/dist/esm/sdk/registrationIntent-DW_kKWlx.js +1 -0
  53. package/dist/esm/sdk/{registrationSignerPlan-BHkqlian.js → registrationSignerPlan-B66FjqIp.js} +1 -1
  54. package/dist/esm/sdk/{requireStepUpAuth-CnSCFSOZ.js → requireStepUpAuth-DsNLml1i.js} +1 -1
  55. package/dist/esm/sdk/routerAbNormalSigning-DSAfCcND.js +1 -0
  56. package/dist/esm/sdk/runtime-auth-BAGyfscG.js +1 -0
  57. package/dist/{public/sdk/runtime-device-link-Dn_5hPCq.js → esm/sdk/runtime-device-link-DKkMLVor.js} +1 -1
  58. package/dist/{public/sdk/runtime-ecdsa-tempo-lTFTb9Rh.js → esm/sdk/runtime-ecdsa-tempo-0TAVH1xg.js} +1 -1
  59. package/dist/esm/sdk/runtime-email-otp-DoHa8Hif.js +1 -0
  60. package/dist/esm/sdk/{runtime-export-Brz53_oi.js → runtime-export-CAt17IFH.js} +1 -1
  61. package/dist/esm/sdk/{runtime-near-Da_xFUXx.js → runtime-near-BQX9Jk9Z.js} +1 -1
  62. package/dist/esm/sdk/runtime-preferences-BuKTIpv6.js +1 -0
  63. package/dist/esm/sdk/runtime-recovery-DyxJKKNw.js +1 -0
  64. package/dist/esm/sdk/runtime-recovery-codes-CWmt0FDB.js +1 -0
  65. package/dist/esm/sdk/secp256k1-CYu8ENjP.js +1 -0
  66. package/dist/esm/sdk/sessionObservationRevision-abErAhd6.js +1 -0
  67. package/dist/esm/sdk/shared-BVps1f3F.js +6 -0
  68. package/dist/esm/sdk/signEvmFamily-C4XMiSue.js +1 -0
  69. package/dist/{public/sdk/signEvmFamilyWithUiConfirmForTempo-NYCFU6Li.js → esm/sdk/signEvmFamilyWithUiConfirmForTempo-4A3D9nKv.js} +1 -1
  70. package/dist/esm/sdk/{signEvmWithUiConfirm-D6nmJr_L.js → signEvmWithUiConfirm-lZyPfrGe.js} +1 -1
  71. package/dist/esm/sdk/signNear-B_UcqMRf.js +1 -0
  72. package/dist/esm/sdk/{signatureUses-B_nN17i7.js → signatureUses-CY4U-X6V.js} +1 -1
  73. package/dist/esm/sdk/{registrationIds-B1OpqRAt.js → signerSlot-CpyIfl3J.js} +1 -1
  74. package/dist/esm/sdk/signingFlow-Co_QtuHK.js +2 -0
  75. package/dist/esm/sdk/signingQueue-Cj9sCJLj.js +1 -0
  76. package/dist/esm/sdk/thresholdEcdsa-LvkD6z8-.js +1 -0
  77. package/dist/esm/sdk/{trace-CsRMlSh1.js → trace-CWTzEALZ.js} +1 -1
  78. package/dist/esm/sdk/{transaction-activity-C0nCSW6c.js → transaction-activity-D5f-Yn9t.js} +1 -1
  79. package/dist/{public/sdk/transactionState-lB2qpkOm.js → esm/sdk/transactionState-BaFSiA9t.js} +1 -1
  80. package/dist/esm/sdk/{types-CQTWmtqu.js → types-BrEW276O.js} +1 -1
  81. package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
  82. package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
  83. package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
  84. package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
  85. package/dist/esm/sdk/wallet-recovery-BEui57xM.js +1 -0
  86. package/dist/esm/sdk/{walletAuthMethodRecord-CWdqdY_s.js → walletAuthMethodRecord-Cv_MYpxt.js} +1 -1
  87. package/dist/esm/sdk/walletCapabilityBindings-CKOK39sP.js +1 -0
  88. package/dist/esm/sdk/walletCustodyEcdsaContinuity-5XsLsT8D.js +1 -0
  89. package/dist/esm/sdk/walletCustodyOperation-BO_tSfGY.js +1 -0
  90. package/dist/esm/sdk/walletDbName-BVZhb4xF.js +1 -0
  91. package/dist/esm/sdk/walletOwnershipGeneration-CQzaodhB.js +1 -0
  92. package/dist/esm/sdk/walletRecoveryAdminProof-CIoLawfC.js +1 -0
  93. package/dist/esm/sdk/walletRecoveryCommit-B_e4k5Pa.js +1 -0
  94. package/dist/esm/sdk/walletRegistrationSetupPrewarm-CQow9u8m.js +1 -0
  95. package/dist/esm/sdk/walletSessionAuthorizationStatus-_KtCVFYW.js +1 -0
  96. package/dist/esm/sdk/walletSessionAuthorizationStore-DYRMCkiT.js +1 -0
  97. package/dist/esm/sdk/warmSessionHydration-CY9ofEGr.js +1 -0
  98. package/dist/{public/sdk/webauthnP256-_ajaNl90.js → esm/sdk/webauthnP256-unqBoZCk.js} +1 -1
  99. package/dist/esm/shared-ts/src/device-linking/deviceManagement.js +2 -3
  100. package/dist/esm/shared-ts/src/utils/evmRpcResults.js +5 -3
  101. package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +2 -1
  102. package/dist/public/headers.manifest.json +1 -1
  103. package/dist/public/sdk/{ConfirmationDrawer-DCw0m-Iv.js → ConfirmationDrawer-B7RCp58z.js} +1 -1
  104. package/dist/public/sdk/{NonceCoordinator-Dq-FZpBz.js → NonceCoordinator-Do23iTzQ.js} +1 -1
  105. package/dist/public/sdk/accountLifecycle-CXTlwnAS.js +1 -0
  106. package/dist/public/sdk/activeWalletSession-BtEHhe99.js +1 -0
  107. package/dist/public/sdk/adapters-La60hveX.js +2 -0
  108. package/dist/public/sdk/challengeDelivery-C88JNwKf.js +1 -0
  109. package/dist/public/sdk/clientSessionPersistenceState-DFGHXoKK.js +1 -0
  110. package/dist/public/sdk/collectAuthenticationCredentialForChallengeB64u-CSwy9csE.js +1 -0
  111. package/dist/public/sdk/{commitQueue-BW7BpYyA.js → commitQueue-BQPOhyGl.js} +1 -1
  112. package/dist/public/sdk/{display-WtILOPQR.js → display-Dtugjeya.js} +1 -1
  113. package/dist/public/sdk/ecdsaCapabilityManifest-B3u6J5gn.js +1 -0
  114. package/dist/public/sdk/{ecdsaDerivationClientWasm-DmwKWUEb.js → ecdsaDerivationClientWasm-D1HzwUgV.js} +1 -1
  115. package/dist/public/sdk/ecdsaDerivationExport-DrFESeRP.js +1 -0
  116. package/dist/public/sdk/ecdsaWalletRecords-BmhuJF1y.js +1 -0
  117. package/dist/public/sdk/emailOtpEcdsaDerivationIdentity-DreNrM6n.js +1 -0
  118. package/dist/public/sdk/{enrichDisplayModelWithAbi-DSj4NAlY.js → enrichDisplayModelWithAbi-D0o0IL7_.js} +1 -1
  119. package/dist/public/sdk/{evmCryptoWasm-DeobzyP-.js → evmCryptoWasm-S2gL5ht4.js} +1 -1
  120. package/dist/public/sdk/{export-viewer-host-DsdzagKK.js → export-viewer-host-CVdpEuY6.js} +1 -1
  121. package/dist/public/sdk/exportKeypairOperation-gVCqLrDl.js +1 -0
  122. package/dist/public/sdk/host-Bz7mRJPZ.js +1 -0
  123. package/dist/public/sdk/keyMaterialEnvelope-B3v6HLtz.js +1 -0
  124. package/dist/public/sdk/{lanes-BzU7cv2T.js → lanes-l274pbT5.js} +1 -1
  125. package/dist/public/sdk/localOnly-TXaYAZj-.js +1 -0
  126. package/dist/public/sdk/{mountExportPrivateKeySurface-DQzFzhNu.js → mountExportPrivateKeySurface-DUnKOBQr.js} +1 -1
  127. package/dist/public/sdk/mountRecoveryCodeBackupSurface-MGTl6FhG.js +2 -0
  128. package/dist/public/sdk/nearEd25519YaoMaterialActivation-BK8_DxHs.js +1 -0
  129. package/dist/public/sdk/nearEd25519YaoSigningPreparation-BgCxoh9S.js +1 -0
  130. package/dist/public/sdk/{nonceLaneKeys-BzMBVxMU.js → nonceLaneKeys-CR2XEvnk.js} +1 -1
  131. package/dist/public/sdk/{normalization-Ct9-AY13.js → normalization-Ctkj80dW.js} +1 -1
  132. package/dist/public/sdk/{operationFingerprint-C4VX-0NI.js → operationFingerprint-DRPONhBD.js} +1 -1
  133. package/dist/public/sdk/pendingWalletRecoveryCodeBackup-DWeemdJv.js +1 -0
  134. package/dist/public/sdk/presignaturePool-DNiA3sgr.js +1 -0
  135. package/dist/{esm/sdk/singletons-CAsc9LvA.js → public/sdk/presignatures-DGLNs29C.js} +1 -1
  136. package/dist/public/sdk/recovery-entrypoint-CNVjXz6A.js +1 -0
  137. package/dist/public/sdk/recoveryAuthorization-BplZWc-N.js +1 -0
  138. package/dist/public/sdk/{registration-DknFwoqn.js → registration-DVX_lnP7.js} +1 -1
  139. package/dist/public/sdk/registration-DeCUrUR9.js +1 -0
  140. package/dist/public/sdk/registrationAccounts-BfO6Ztye.js +1 -0
  141. package/dist/public/sdk/registrationIntent-DW_kKWlx.js +1 -0
  142. package/dist/public/sdk/{registrationSignerPlan-BHkqlian.js → registrationSignerPlan-B66FjqIp.js} +1 -1
  143. package/dist/public/sdk/{requireStepUpAuth-CnSCFSOZ.js → requireStepUpAuth-DsNLml1i.js} +1 -1
  144. package/dist/public/sdk/routerAbNormalSigning-DSAfCcND.js +1 -0
  145. package/dist/public/sdk/runtime-auth-BAGyfscG.js +1 -0
  146. package/dist/{esm/sdk/runtime-device-link-Dn_5hPCq.js → public/sdk/runtime-device-link-DKkMLVor.js} +1 -1
  147. package/dist/{esm/sdk/runtime-ecdsa-tempo-lTFTb9Rh.js → public/sdk/runtime-ecdsa-tempo-0TAVH1xg.js} +1 -1
  148. package/dist/public/sdk/runtime-email-otp-DoHa8Hif.js +1 -0
  149. package/dist/public/sdk/{runtime-export-Brz53_oi.js → runtime-export-CAt17IFH.js} +1 -1
  150. package/dist/public/sdk/{runtime-near-Da_xFUXx.js → runtime-near-BQX9Jk9Z.js} +1 -1
  151. package/dist/public/sdk/runtime-preferences-BuKTIpv6.js +1 -0
  152. package/dist/public/sdk/runtime-recovery-DyxJKKNw.js +1 -0
  153. package/dist/public/sdk/runtime-recovery-codes-CWmt0FDB.js +1 -0
  154. package/dist/public/sdk/secp256k1-CYu8ENjP.js +1 -0
  155. package/dist/public/sdk/sessionObservationRevision-abErAhd6.js +1 -0
  156. package/dist/public/sdk/shared-BVps1f3F.js +6 -0
  157. package/dist/public/sdk/signEvmFamily-C4XMiSue.js +1 -0
  158. package/dist/{esm/sdk/signEvmFamilyWithUiConfirmForTempo-NYCFU6Li.js → public/sdk/signEvmFamilyWithUiConfirmForTempo-4A3D9nKv.js} +1 -1
  159. package/dist/public/sdk/{signEvmWithUiConfirm-D6nmJr_L.js → signEvmWithUiConfirm-lZyPfrGe.js} +1 -1
  160. package/dist/public/sdk/signNear-B_UcqMRf.js +1 -0
  161. package/dist/public/sdk/{signatureUses-B_nN17i7.js → signatureUses-CY4U-X6V.js} +1 -1
  162. package/dist/public/sdk/{registrationIds-B1OpqRAt.js → signerSlot-CpyIfl3J.js} +1 -1
  163. package/dist/public/sdk/signingFlow-Co_QtuHK.js +2 -0
  164. package/dist/public/sdk/signingQueue-Cj9sCJLj.js +1 -0
  165. package/dist/public/sdk/thresholdEcdsa-LvkD6z8-.js +1 -0
  166. package/dist/public/sdk/{trace-CsRMlSh1.js → trace-CWTzEALZ.js} +1 -1
  167. package/dist/public/sdk/{transaction-activity-C0nCSW6c.js → transaction-activity-D5f-Yn9t.js} +1 -1
  168. package/dist/{esm/sdk/transactionState-lB2qpkOm.js → public/sdk/transactionState-BaFSiA9t.js} +1 -1
  169. package/dist/public/sdk/{types-CQTWmtqu.js → types-BrEW276O.js} +1 -1
  170. package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
  171. package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
  172. package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
  173. package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
  174. package/dist/public/sdk/wallet-recovery-BEui57xM.js +1 -0
  175. package/dist/public/sdk/{walletAuthMethodRecord-CWdqdY_s.js → walletAuthMethodRecord-Cv_MYpxt.js} +1 -1
  176. package/dist/public/sdk/walletCapabilityBindings-CKOK39sP.js +1 -0
  177. package/dist/public/sdk/walletCustodyEcdsaContinuity-5XsLsT8D.js +1 -0
  178. package/dist/public/sdk/walletCustodyOperation-BO_tSfGY.js +1 -0
  179. package/dist/public/sdk/walletDbName-BVZhb4xF.js +1 -0
  180. package/dist/public/sdk/walletOwnershipGeneration-CQzaodhB.js +1 -0
  181. package/dist/public/sdk/walletRecoveryAdminProof-CIoLawfC.js +1 -0
  182. package/dist/public/sdk/walletRecoveryCommit-B_e4k5Pa.js +1 -0
  183. package/dist/public/sdk/walletRegistrationSetupPrewarm-CQow9u8m.js +1 -0
  184. package/dist/public/sdk/walletSessionAuthorizationStatus-_KtCVFYW.js +1 -0
  185. package/dist/public/sdk/walletSessionAuthorizationStore-DYRMCkiT.js +1 -0
  186. package/dist/public/sdk/warmSessionHydration-CY9ofEGr.js +1 -0
  187. package/dist/{esm/sdk/webauthnP256-_ajaNl90.js → public/sdk/webauthnP256-unqBoZCk.js} +1 -1
  188. package/dist/public/sdk/workers/email-otp.worker.js +6 -1
  189. package/dist/public/wallet-assets.manifest.json +253 -276
  190. package/dist/public/wallet-service/index.html +4 -4
  191. package/dist/types/shared-ts/src/authorization/walletCustodyOperation.d.ts +1 -1
  192. package/dist/types/shared-ts/src/device-linking/contracts.d.ts +1 -7
  193. package/dist/types/shared-ts/src/passkey-custody/ceremonyCommitPayload.d.ts +5 -0
  194. package/dist/types/shared-ts/src/utils/evmRpcResults.d.ts +3 -3
  195. package/dist/types/shared-ts/src/utils/routerAbEcdsaDerivation.d.ts +1 -1
  196. package/dist/types/wallet/src/SeamsWeb/operations/recovery/walletRecoveryAdminProof.d.ts +46 -0
  197. package/dist/types/wallet/src/SeamsWeb/operations/recovery/walletRecoveryCodeBackup.d.ts +4 -1
  198. package/dist/types/wallet/src/SeamsWeb/operations/recovery/walletRecoveryRotation.d.ts +11 -7
  199. package/dist/types/wallet/src/SeamsWeb/publicApi/types.d.ts +9 -1
  200. package/dist/types/wallet/src/SeamsWeb/signingSurface/BrowserSigningSurface.d.ts +4 -3
  201. package/dist/types/wallet/src/SeamsWeb/signingSurface/ports.d.ts +6 -4
  202. package/dist/types/wallet/src/SeamsWeb/signingSurface/types.d.ts +2 -2
  203. package/dist/types/wallet/src/SeamsWeb/walletIframe/client/router.d.ts +2 -6
  204. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/WalletHostRuntime.d.ts +1 -0
  205. package/dist/types/wallet/src/SeamsWeb/walletIframe/host/requestWalletMove.d.ts +1 -1
  206. package/dist/types/wallet/src/SeamsWeb/walletIframe/shared/messages.d.ts +5 -1
  207. package/dist/types/wallet/src/SeamsWeb/walletIframe/shared/recoveryAuthorization.d.ts +6 -0
  208. package/dist/types/wallet/src/core/indexedDB/seamsWalletDB/pendingWalletRecoveryCodeBackup.d.ts +14 -3
  209. package/dist/types/wallet/src/core/rpcClients/relayer/walletRecoveryRotate.d.ts +8 -0
  210. package/dist/types/wallet/src/core/signingEngine/uiConfirm/ui/preact/RecoveryCodeBackupSurface.d.ts +1 -0
  211. package/dist/types/wallet/src/core/signingEngine/walletCustody/walletRecoveryRotation.d.ts +22 -3
  212. package/dist/types/wallet/src/core/signingEngine/workerManager/workerTypes.d.ts +1 -0
  213. package/dist/types/wallet/src/core/signingEngine/workerManager/workers/email-otp/unlock.d.ts +1 -0
  214. package/dist/types/wallet/src/core/types/sdkSentEvents.d.ts +8 -2
  215. package/dist/types/wallet/src/plugins/plugin-utils.d.ts +1 -1
  216. package/dist/workers/email-otp.worker.js +6 -1
  217. package/package.json +1 -1
  218. package/dist/esm/sdk/accountLifecycle-fLNUdjct.js +0 -1
  219. package/dist/esm/sdk/activeWalletSession-BpbnpU9s.js +0 -1
  220. package/dist/esm/sdk/adapters-BNmcyf9K.js +0 -2
  221. package/dist/esm/sdk/challengeDelivery-CG2J5Qxs.js +0 -1
  222. package/dist/esm/sdk/clientSessionPersistenceState-BgO4P6CZ.js +0 -1
  223. package/dist/esm/sdk/digestEncoding-aC4dSf_x.js +0 -1
  224. package/dist/esm/sdk/ecdsaCapabilityManifest-DRc423SV.js +0 -1
  225. package/dist/esm/sdk/ecdsaDerivationExport-DX89rq_u.js +0 -1
  226. package/dist/esm/sdk/ecdsaWalletRecords-CxxUt3fS.js +0 -1
  227. package/dist/esm/sdk/emailOtpEcdsaDerivationIdentity-CupWCKNg.js +0 -1
  228. package/dist/esm/sdk/exportKeypairOperation-BwW_E4Lt.js +0 -1
  229. package/dist/esm/sdk/host-DMR4KDy9.js +0 -1
  230. package/dist/esm/sdk/localOnly-DO191vDh.js +0 -1
  231. package/dist/esm/sdk/mountRecoveryCodeBackupSurface-B1D0ovqx.js +0 -2
  232. package/dist/esm/sdk/nearEd25519YaoMaterialActivation-DgWDGRI_.js +0 -1
  233. package/dist/esm/sdk/nearEd25519YaoSigningPreparation-yKDLQXBS.js +0 -1
  234. package/dist/esm/sdk/passkey-custody-Ba-NQ_4C.js +0 -1
  235. package/dist/esm/sdk/pendingWalletRecoveryCodeBackup-DOeIn_Qj.js +0 -1
  236. package/dist/esm/sdk/presignaturePool-BHoxnbOA.js +0 -1
  237. package/dist/esm/sdk/presignatures-K-yuzOE0.js +0 -1
  238. package/dist/esm/sdk/primitives-CTmDwMNc.js +0 -1
  239. package/dist/esm/sdk/recovery-entrypoint-DWghFZrZ.js +0 -1
  240. package/dist/esm/sdk/registration-sQndIWRF.js +0 -1
  241. package/dist/esm/sdk/registrationAccounts-CD1u1ZqZ.js +0 -1
  242. package/dist/esm/sdk/registrationIntent-D4YDjf2U.js +0 -1
  243. package/dist/esm/sdk/routerAbNormalSigning-BV1t27aB.js +0 -1
  244. package/dist/esm/sdk/runtime-auth-BxG-J-BB.js +0 -1
  245. package/dist/esm/sdk/runtime-email-otp-CPqTCH8Q.js +0 -1
  246. package/dist/esm/sdk/runtime-preferences-riUZGaTs.js +0 -1
  247. package/dist/esm/sdk/runtime-recovery-CTj4nDAM.js +0 -1
  248. package/dist/esm/sdk/runtime-recovery-codes-D8T9LQ7-.js +0 -1
  249. package/dist/esm/sdk/secp256k1-wOOHtPcK.js +0 -1
  250. package/dist/esm/sdk/sessionObservationRevision-C7v-wN8_.js +0 -1
  251. package/dist/esm/sdk/shared-hx7KVyeq.js +0 -6
  252. package/dist/esm/sdk/signEvmFamily-DT34Vtpa.js +0 -1
  253. package/dist/esm/sdk/signNear-B000QxBd.js +0 -1
  254. package/dist/esm/sdk/signerSlot-FJAGOhmg.js +0 -1
  255. package/dist/esm/sdk/signingFlow-gl85GOW4.js +0 -2
  256. package/dist/esm/sdk/signingQueue-gW7wmOuL.js +0 -1
  257. package/dist/esm/sdk/thresholdEcdsa-Ci7yz395.js +0 -1
  258. package/dist/esm/sdk/wallet-recovery-DFaS3geI.js +0 -1
  259. package/dist/esm/sdk/walletAuthority-BY3kyKQ-.js +0 -1
  260. package/dist/esm/sdk/walletCustodyEcdsaContinuity-mGh1Ysko.js +0 -1
  261. package/dist/esm/sdk/walletDbName-BxWApBQF.js +0 -1
  262. package/dist/esm/sdk/walletOwnershipGeneration-DSGfjuV2.js +0 -1
  263. package/dist/esm/sdk/walletRecoveryCommit-DQA_wveK.js +0 -1
  264. package/dist/esm/sdk/walletRecoveryRotate-zvQThn37.js +0 -1
  265. package/dist/esm/sdk/walletRegistrationSetupPrewarm-DdVpKccU.js +0 -1
  266. package/dist/esm/sdk/walletSessionAuthorizationStatus-ONPRiEbK.js +0 -1
  267. package/dist/esm/sdk/walletSessionAuthorizationStore-DnUMtkev.js +0 -1
  268. package/dist/esm/sdk/warmSessionHydration-D8Vdro9n.js +0 -1
  269. package/dist/public/sdk/accountLifecycle-fLNUdjct.js +0 -1
  270. package/dist/public/sdk/activeWalletSession-BpbnpU9s.js +0 -1
  271. package/dist/public/sdk/adapters-BNmcyf9K.js +0 -2
  272. package/dist/public/sdk/challengeDelivery-CG2J5Qxs.js +0 -1
  273. package/dist/public/sdk/clientSessionPersistenceState-BgO4P6CZ.js +0 -1
  274. package/dist/public/sdk/digestEncoding-aC4dSf_x.js +0 -1
  275. package/dist/public/sdk/ecdsaCapabilityManifest-DRc423SV.js +0 -1
  276. package/dist/public/sdk/ecdsaDerivationExport-DX89rq_u.js +0 -1
  277. package/dist/public/sdk/ecdsaWalletRecords-CxxUt3fS.js +0 -1
  278. package/dist/public/sdk/emailOtpEcdsaDerivationIdentity-CupWCKNg.js +0 -1
  279. package/dist/public/sdk/exportKeypairOperation-BwW_E4Lt.js +0 -1
  280. package/dist/public/sdk/host-DMR4KDy9.js +0 -1
  281. package/dist/public/sdk/localOnly-DO191vDh.js +0 -1
  282. package/dist/public/sdk/mountRecoveryCodeBackupSurface-B1D0ovqx.js +0 -2
  283. package/dist/public/sdk/nearEd25519YaoMaterialActivation-DgWDGRI_.js +0 -1
  284. package/dist/public/sdk/nearEd25519YaoSigningPreparation-yKDLQXBS.js +0 -1
  285. package/dist/public/sdk/passkey-custody-Ba-NQ_4C.js +0 -1
  286. package/dist/public/sdk/pendingWalletRecoveryCodeBackup-DOeIn_Qj.js +0 -1
  287. package/dist/public/sdk/presignaturePool-BHoxnbOA.js +0 -1
  288. package/dist/public/sdk/presignatures-K-yuzOE0.js +0 -1
  289. package/dist/public/sdk/primitives-CTmDwMNc.js +0 -1
  290. package/dist/public/sdk/recovery-entrypoint-DWghFZrZ.js +0 -1
  291. package/dist/public/sdk/registration-sQndIWRF.js +0 -1
  292. package/dist/public/sdk/registrationAccounts-CD1u1ZqZ.js +0 -1
  293. package/dist/public/sdk/registrationIntent-D4YDjf2U.js +0 -1
  294. package/dist/public/sdk/routerAbNormalSigning-BV1t27aB.js +0 -1
  295. package/dist/public/sdk/runtime-auth-BxG-J-BB.js +0 -1
  296. package/dist/public/sdk/runtime-email-otp-CPqTCH8Q.js +0 -1
  297. package/dist/public/sdk/runtime-preferences-riUZGaTs.js +0 -1
  298. package/dist/public/sdk/runtime-recovery-CTj4nDAM.js +0 -1
  299. package/dist/public/sdk/runtime-recovery-codes-D8T9LQ7-.js +0 -1
  300. package/dist/public/sdk/secp256k1-wOOHtPcK.js +0 -1
  301. package/dist/public/sdk/sessionObservationRevision-C7v-wN8_.js +0 -1
  302. package/dist/public/sdk/shared-hx7KVyeq.js +0 -6
  303. package/dist/public/sdk/signEvmFamily-DT34Vtpa.js +0 -1
  304. package/dist/public/sdk/signNear-B000QxBd.js +0 -1
  305. package/dist/public/sdk/signerSlot-FJAGOhmg.js +0 -1
  306. package/dist/public/sdk/signingFlow-gl85GOW4.js +0 -2
  307. package/dist/public/sdk/signingQueue-gW7wmOuL.js +0 -1
  308. package/dist/public/sdk/thresholdEcdsa-Ci7yz395.js +0 -1
  309. package/dist/public/sdk/wallet-recovery-DFaS3geI.js +0 -1
  310. package/dist/public/sdk/walletAuthority-BY3kyKQ-.js +0 -1
  311. package/dist/public/sdk/walletCustodyEcdsaContinuity-mGh1Ysko.js +0 -1
  312. package/dist/public/sdk/walletDbName-BxWApBQF.js +0 -1
  313. package/dist/public/sdk/walletOwnershipGeneration-DSGfjuV2.js +0 -1
  314. package/dist/public/sdk/walletRecoveryCommit-DQA_wveK.js +0 -1
  315. package/dist/public/sdk/walletRecoveryRotate-zvQThn37.js +0 -1
  316. package/dist/public/sdk/walletRegistrationSetupPrewarm-DdVpKccU.js +0 -1
  317. package/dist/public/sdk/walletSessionAuthorizationStatus-ONPRiEbK.js +0 -1
  318. package/dist/public/sdk/walletSessionAuthorizationStore-DnUMtkev.js +0 -1
  319. package/dist/public/sdk/warmSessionHydration-D8Vdro9n.js +0 -1
  320. /package/dist/esm/sdk/{accountIds-Cpvlkvbe.js → accountIds-BzZs7YoX.js} +0 -0
  321. /package/dist/esm/sdk/{appearance-4DmzKUWf.js → appearance-ZGVLwA4N.js} +0 -0
  322. /package/dist/esm/sdk/{appearance-token-vars-DxBm_cKA.js → appearance-token-vars-Bu6YUWmf.js} +0 -0
  323. /package/dist/esm/sdk/{authenticatorOptions-2_XK8aXv.js → authenticatorOptions-BB_sU4uA.js} +0 -0
  324. /package/dist/esm/sdk/{authorizationAdmission-Dd23mTx7.js → authorizationAdmission-D7nx2n4d.js} +0 -0
  325. /package/dist/esm/sdk/{browser-n3IVr7qu.js → browser-DkCRXFkk.js} +0 -0
  326. /package/dist/esm/sdk/{bytes-DZRW2UDg.js → bytes-Cv07P0Pu.js} +0 -0
  327. /package/dist/esm/sdk/{canonicalPrimitives-BMP5yILS.js → canonicalPrimitives-D_1HyEuJ.js} +0 -0
  328. /package/dist/esm/sdk/{canonicalSignerErrorCode-Cz48v4oy.js → canonicalSignerErrorCode-CqHi6ji6.js} +0 -0
  329. /package/dist/esm/sdk/{capabilityKinds-D0Yrp9uf.js → capabilityKinds-CqHVzVsJ.js} +0 -0
  330. /package/dist/esm/sdk/{ecdsaChainTarget-DkOrgv4y.js → ecdsaChainTarget-svSlzhze.js} +0 -0
  331. /package/dist/esm/sdk/{errors-ADOZT8oV.js → errors-CI1xdN0d.js} +0 -0
  332. /package/dist/esm/sdk/{executeWorkerOperation-DKCRRq5E.js → executeWorkerOperation-S6glYwAs.js} +0 -0
  333. /package/dist/esm/sdk/{helpers-DS0bksx9.js → helpers-BXezXx19.js} +0 -0
  334. /package/dist/esm/sdk/{intentDigest-Rh5Mg8X7.js → intentDigest--FZ63NBy.js} +0 -0
  335. /package/dist/esm/sdk/{jsonRpc-BVDv1wfm.js → jsonRpc-B5zMY6lE.js} +0 -0
  336. /package/dist/esm/sdk/{keccak-mS0Mejjx.js → keccak-CaPOCznk.js} +0 -0
  337. /package/dist/esm/sdk/{normalization-C6fQN6mW.js → normalization-CpLZcL2f.js} +0 -0
  338. /package/dist/esm/sdk/{prfCache-BAFh1skJ.js → prfCache-D25ZCg5n.js} +0 -0
  339. /package/dist/esm/sdk/{profileAccountProjection-BNVJLOt2.js → profileAccountProjection-C1z9sKHa.js} +0 -0
  340. /package/dist/esm/sdk/{promptText-CnyrLxgj.js → promptText-D2f5Rg0h.js} +0 -0
  341. /package/dist/esm/sdk/{registrationAuthMethodInput-B23_HRil.js → registrationAuthMethodInput-DKz6Mgg4.js} +0 -0
  342. /package/dist/esm/sdk/{sdkSentEvents-DujYAPEM.js → sdkSentEvents-BzMVO1AR.js} +0 -0
  343. /package/dist/esm/sdk/{signer-worker-DlK58rEA.js → signer-worker-Bh_5foqX.js} +0 -0
  344. /package/dist/esm/sdk/{signerDomain-BFqRQ0Jl.js → signerDomain-YEHkugWX.js} +0 -0
  345. /package/dist/esm/sdk/{surface-measurement-reporter-BJhfiPw6.js → surface-measurement-reporter-F-fVB7d3.js} +0 -0
  346. /package/dist/esm/sdk/{types-Buoe6179.js → types-BNUuaUtl.js} +0 -0
  347. /package/dist/esm/sdk/{walletIframeIdentity-Cz82I_Uh.js → walletIframeIdentity-DJ0KOBHg.js} +0 -0
  348. /package/dist/esm/sdk/{walletSessionAuthorizationProjection-DuU6w0FP.js → walletSessionAuthorizationProjection-UdGeS6x3.js} +0 -0
  349. /package/dist/esm/sdk/{walletSessionFailure-C6TAQTZn.js → walletSessionFailure-Ct412mDZ.js} +0 -0
  350. /package/dist/esm/sdk/{webauthnPromptCoordinator-9bVeHcTZ.js → webauthnPromptCoordinator-CBkTiMP0.js} +0 -0
  351. /package/dist/public/sdk/{accountIds-Cpvlkvbe.js → accountIds-BzZs7YoX.js} +0 -0
  352. /package/dist/public/sdk/{appearance-4DmzKUWf.js → appearance-ZGVLwA4N.js} +0 -0
  353. /package/dist/public/sdk/{appearance-token-vars-DxBm_cKA.js → appearance-token-vars-Bu6YUWmf.js} +0 -0
  354. /package/dist/public/sdk/{authenticatorOptions-2_XK8aXv.js → authenticatorOptions-BB_sU4uA.js} +0 -0
  355. /package/dist/public/sdk/{authorizationAdmission-Dd23mTx7.js → authorizationAdmission-D7nx2n4d.js} +0 -0
  356. /package/dist/public/sdk/{browser-n3IVr7qu.js → browser-DkCRXFkk.js} +0 -0
  357. /package/dist/public/sdk/{bytes-DZRW2UDg.js → bytes-Cv07P0Pu.js} +0 -0
  358. /package/dist/public/sdk/{canonicalPrimitives-BMP5yILS.js → canonicalPrimitives-D_1HyEuJ.js} +0 -0
  359. /package/dist/public/sdk/{canonicalSignerErrorCode-Cz48v4oy.js → canonicalSignerErrorCode-CqHi6ji6.js} +0 -0
  360. /package/dist/public/sdk/{capabilityKinds-D0Yrp9uf.js → capabilityKinds-CqHVzVsJ.js} +0 -0
  361. /package/dist/public/sdk/{ecdsaChainTarget-DkOrgv4y.js → ecdsaChainTarget-svSlzhze.js} +0 -0
  362. /package/dist/public/sdk/{errors-ADOZT8oV.js → errors-CI1xdN0d.js} +0 -0
  363. /package/dist/public/sdk/{executeWorkerOperation-DKCRRq5E.js → executeWorkerOperation-S6glYwAs.js} +0 -0
  364. /package/dist/public/sdk/{helpers-DS0bksx9.js → helpers-BXezXx19.js} +0 -0
  365. /package/dist/public/sdk/{intentDigest-Rh5Mg8X7.js → intentDigest--FZ63NBy.js} +0 -0
  366. /package/dist/public/sdk/{jsonRpc-BVDv1wfm.js → jsonRpc-B5zMY6lE.js} +0 -0
  367. /package/dist/public/sdk/{keccak-mS0Mejjx.js → keccak-CaPOCznk.js} +0 -0
  368. /package/dist/public/sdk/{normalization-C6fQN6mW.js → normalization-CpLZcL2f.js} +0 -0
  369. /package/dist/public/sdk/{prfCache-BAFh1skJ.js → prfCache-D25ZCg5n.js} +0 -0
  370. /package/dist/public/sdk/{profileAccountProjection-BNVJLOt2.js → profileAccountProjection-C1z9sKHa.js} +0 -0
  371. /package/dist/public/sdk/{promptText-CnyrLxgj.js → promptText-D2f5Rg0h.js} +0 -0
  372. /package/dist/public/sdk/{registrationAuthMethodInput-B23_HRil.js → registrationAuthMethodInput-DKz6Mgg4.js} +0 -0
  373. /package/dist/public/sdk/{sdkSentEvents-DujYAPEM.js → sdkSentEvents-BzMVO1AR.js} +0 -0
  374. /package/dist/public/sdk/{signer-worker-DlK58rEA.js → signer-worker-Bh_5foqX.js} +0 -0
  375. /package/dist/public/sdk/{signerDomain-BFqRQ0Jl.js → signerDomain-YEHkugWX.js} +0 -0
  376. /package/dist/public/sdk/{surface-measurement-reporter-BJhfiPw6.js → surface-measurement-reporter-F-fVB7d3.js} +0 -0
  377. /package/dist/public/sdk/{types-Buoe6179.js → types-BNUuaUtl.js} +0 -0
  378. /package/dist/public/sdk/{walletIframeIdentity-Cz82I_Uh.js → walletIframeIdentity-DJ0KOBHg.js} +0 -0
  379. /package/dist/public/sdk/{walletSessionAuthorizationProjection-DuU6w0FP.js → walletSessionAuthorizationProjection-UdGeS6x3.js} +0 -0
  380. /package/dist/public/sdk/{walletSessionFailure-C6TAQTZn.js → walletSessionFailure-Ct412mDZ.js} +0 -0
  381. /package/dist/public/sdk/{webauthnPromptCoordinator-9bVeHcTZ.js → webauthnPromptCoordinator-CBkTiMP0.js} +0 -0
@@ -0,0 +1 @@
1
+ import{B as e}from"./domainIds-C3fUa33Q.js";import{d as t}from"./chains-CPmd4s9f.js";import{i as n,r}from"./base64-BmKR3UqU.js";import{d as i,n as a,t as o}from"./accountIds-BzZs7YoX.js";import{t as s}from"./registrationSignerPlan-B66FjqIp.js";import{c,o as l}from"./ecdsaChainTarget-svSlzhze.js";import{i as u,n as d,r as f}from"./signerDomain-YEHkugWX.js";import{s as p,t as m}from"./normalization-Ctkj80dW.js";import{a as h,i as g,t as _}from"./keyMaterialEnvelope-B3v6HLtz.js";import{i as v,t as y}from"./signerSlot-CpyIfl3J.js";import{a as b,i as x,n as ee,o as S,r as C,t as te}from"./profileAccountProjection-C1z9sKHa.js";function ne(e){return e===d.emailOtp?d.emailOtp:e===d.passkey?d.passkey:null}function re(t){if(t.authMethod===d.emailOtp){let n=e(t.metadata.email||``);if(n)return n}return t.walletId}async function w(t,n,r){let i=o(n),a=m(i);if(!a)return null;let s=await C(t,{accountRefs:b(i).map(e=>({chainIdKey:e,accountAddress:a})),signerSlot:r});if(!s)return null;let c=s.selectedSigner.metadata||{},l=typeof c.passkeyCredentialRawId==`string`?c.passkeyCredentialRawId:s.selectedSigner.signerId,u=typeof c.passkeyCredentialId==`string`?c.passkeyCredentialId:s.profile.passkeyCredential?.id||l,d=typeof c.operationalPublicKey==`string`?c.operationalPublicKey:``,f=e(c.nearEd25519SigningKeyId||``);if(!f)return null;let p=e(c.walletId||``);if(!p)return null;let h=ne(s.selectedSigner.signerAuthMethod);return{walletId:p,nearAccountId:i,loginDisplayName:re({walletId:p,authMethod:h,metadata:c}),signerSlot:s.selectedSigner.signerSlot,version:2,registeredAt:s.profile.createdAt,lastLogin:s.profile.updatedAt,lastUpdated:s.profile.updatedAt,operationalPublicKey:d,nearEd25519SigningKeyId:f,passkeyCredential:{id:u,rawId:l},authMethod:h,preferences:s.profile.preferences}}async function ie(e){let t=await te(e,{chainIdKeys:[`near:testnet`,`near:mainnet`]});if(!t?.chainAccount?.accountAddress)return null;let n;try{n=o(t.chainAccount.accountAddress)}catch{return null}return{nearAccountId:n,profileId:t.profileId,signerSlot:t.signerSlot}}async function ae(e){let t=await ie(e).catch(()=>null);return t?w(e,t.nearAccountId,t.signerSlot):null}async function oe(t){let[n,r]=await Promise.all([t.listChainAccountsByChain(`near:testnet`),t.listChainAccountsByChain(`near:mainnet`)]),i=new Set;for(let t of[...n,...r]){let n=e(t.accountAddress||``);if(n)try{i.add(o(n))}catch{}}let a=[],s=new Set;for(let e of i){let n=await C(t,{accountRefs:b(e).map(t=>({chainIdKey:t,accountAddress:m(e)}))}).catch(()=>null);if(!n)continue;let r=n.activeSigners.filter(e=>e.signerKind===f.thresholdEd25519&&ne(e.signerAuthMethod)).slice().sort((e,t)=>e.signerSlot-t.signerSlot);for(let n of r){let r=Number(n.signerSlot);if(!Number.isSafeInteger(r)||r<1)continue;let i=`${String(e)}:${r}`;if(s.has(i))continue;s.add(i);let o=await w(t,e,r).catch(()=>null);o&&a.push(o)}}return a}const T=`wallet_custody_ed25519_active_client_v1`,E=`chacha20poly1305-hkdf-sha256-wallet-custody-seed-v1`;function D(e){for(let[t,n]of[[`walletId`,e.walletId],[`nearAccountId`,e.nearAccountId],[`nearEd25519SigningKeyId`,e.nearEd25519SigningKeyId],[`signingWorkerId`,e.signingWorkerId],[`applicationBindingDigestB64u`,e.applicationBindingDigestB64u],[`signingWorkerVerifyingShareB64u`,e.signingWorkerVerifyingShareB64u],[`stateEpoch`,e.stateEpoch]])if(!String(n||``).trim())throw Error(`Wallet custody Ed25519 material binding requires ${t}`);if(e.participantIds.length!==2)throw Error(`Wallet custody Ed25519 material binding requires exactly two participants`)}function O(e){let{binding:t,sealed:n,target:a}=e;D(t);let o=r(t.registeredPublicKeyB64u);if(o.length!==32)throw Error(`Wallet custody Ed25519 material requires a 32-byte registered public key`);if(!n.ciphertextB64u||!n.nonceB64u)throw Error(`Wallet custody Ed25519 material requires its sealed ciphertext and nonce`);return{profileId:a.profileId,signerSlot:t.signerSlot,chainIdKey:a.chainIdKey,accountAddress:a.accountAddress,keyKind:T,algorithm:`ed25519`,publicKey:`ed25519:${i(o)}`,signerId:t.nearEd25519SigningKeyId,payload:{binding:t},payloadEnvelope:{encVersion:1,alg:E,nonce:n.nonceB64u,ciphertext:n.ciphertextB64u,aad:_({profileId:a.profileId,signerSlot:t.signerSlot,chainIdKey:a.chainIdKey,accountAddress:a.accountAddress,keyKind:T,schemaVersion:1,signerId:t.nearEd25519SigningKeyId})},timestamp:Date.now(),schemaVersion:1}}const k=`threshold-ecdsa`,A={signerAuthMethod:d.passkey,signerSource:u.passkeyRegistration},j={signerAuthMethod:d.emailOtp,signerSource:u.emailOtpRegistration};function M(e,t){let n=String(e||``).trim();if(!n)throw Error(`SeamsWalletDB: ${t} is required`);let i=r(n);if(i.length===0)throw Error(`SeamsWalletDB: ${t} decoded to empty credential public key`);return i}async function N(e,t){let n=o(t),r=await ee(e.accountStore,x(n)).catch(()=>null);if(!r?.profileId)return null;let i=h(r.profileId);return i.ok?{profileId:i.value}:null}async function se(e,t){let n=o(t.nearAccountId),r=Number(t.signerSlot);if(!Number.isSafeInteger(r)||r<1)throw Error(`SeamsWalletDB: storeUserData requires an exact signerSlot`);let i=r,a=c(t.walletId),s=g(n),l=S(n,t.preferences?.useNetwork),p=m(n),h=String(t.passkeyCredential?.rawId||``).trim()||`signer-${i}`;await e.accountStore.upsertProfile({profileId:s,defaultSignerSlot:i,passkeyCredential:t.passkeyCredential,...t.preferences?{preferences:t.preferences}:{}});let _=await e.accountStore.getAccountSigner({chainIdKey:l,accountAddress:p,signerId:h}).catch(()=>null),v=await e.accountStore.activateAccountSigner({account:{profileId:s,chainIdKey:l,accountAddress:p,accountModel:`near-native`},signer:{signerId:h,signerType:`threshold`,signerKind:f.thresholdEd25519,signerAuthMethod:d.passkey,signerSource:u.passkeyRegistration,metadata:{..._?.metadata||{},walletId:String(a),nearAccountId:String(n),nearEd25519SigningKeyId:t.nearEd25519SigningKeyId,operationalPublicKey:t.operationalPublicKey,passkeyCredentialId:t.passkeyCredential?.id,passkeyCredentialRawId:t.passkeyCredential?.rawId}},activationPolicy:{mode:`allocate_next_free`},preferredSlot:i,mutation:{routeThroughOutbox:!1}});v.signerSlot!==i&&await e.accountStore.upsertProfile({profileId:s,defaultSignerSlot:v.signerSlot,passkeyCredential:t.passkeyCredential,...t.preferences?{preferences:t.preferences}:{}}),await e.accountStore.setLastProfileStateForProfile(s,v.signerSlot)}function ce(e){return oe(e.accountStore)}function le(e,t,n){return w(e.accountStore,t,n)}function ue(e){return ae(e.accountStore)}function de(e,t,n){return{nearAccountId:t,signerSlot:n??e.signerSlot,credentialId:e.credentialId,credentialPublicKey:e.credentialPublicKey,transports:e.transports,name:e.name,registered:e.registered,syncedAt:e.syncedAt}}function fe(e){if(e.signerAuthMethod!==d.passkey)return null;let t=String(e.metadata?.walletId||``).trim(),n=String(e.metadata?.passkeyCredentialRawId||``).trim();return!t||!n?null:{walletId:t,credentialId:n,signerSlot:e.signerSlot}}async function pe(e,t){let n=(await e.accountStore.listAccountSigners({chainIdKey:t.chainIdKey,accountAddress:t.accountAddress,status:`active`})).map(fe).filter(e=>e!==null),r=new Map;for(let e of n){let t=r.get(e.walletId);t?t.push(e):r.set(e.walletId,[e])}let i=[];for(let[n,a]of r.entries()){let r=await e.accountStore.listProfileAuthenticators(n);for(let e of a){let n=r.find(t=>t.credentialId===e.credentialId);n&&i.push(de(n,t.nearAccountId,e.signerSlot))}}return i}async function P(e,t){let n=o(t),r=await ee(e.accountStore,x(n)).catch(()=>null);return r?.accountRef?await pe(e,{nearAccountId:n,chainIdKey:r.accountRef.chainIdKey,accountAddress:r.accountRef.accountAddress}):[]}async function me(e,t,n){let r=Number(n);if(!Number.isSafeInteger(r)||r<1)throw Error(`SeamsWalletDB: signerSlot must be an integer >= 1`);let i=String(t||``).trim();if(!i)throw Error(`SeamsWalletDB: selected wallet id is required`);let a=await e.accountStore.getProfile(i).catch(()=>null);if(!a?.profileId)throw Error(`SeamsWalletDB: Missing profile for wallet ${i}`);await e.accountStore.setLastProfileStateForProfile(a.profileId,r)}function he(e){try{return c(e)}catch{return null}}function ge(e){if(typeof e!=`string`)return null;try{return o(e)}catch{return null}}function _e(e){if(typeof e!=`string`||!e.trim())return null;try{return v(e)}catch{return null}}async function ve(e,t){let n=null;try{n=await C(e.accountStore,{accountRefs:x(t.nearAccountId),signerSlot:t.signerSlot})}catch{n=null}if(!n)throw Error(`Authenticated wallet activation requires an exact NEAR signer projection`);let r=h(n.context.profileId);if(!r.ok)throw Error(r.message);let i=n.selectedSigner,a=i.metadata||{},o=he(a.walletId),s=ge(a.nearAccountId),c=_e(a.nearEd25519SigningKeyId),l=typeof a.operationalPublicKey==`string`?a.operationalPublicKey.trim():``;if(i.signerKind!==f.thresholdEd25519||i.signerSlot!==t.signerSlot||o!==t.walletId||s!==t.nearAccountId||!c||!l)throw Error(`Authenticated wallet activation requires an exact wallet signer binding`);return{kind:`authenticated_near_ed25519_wallet_profile_binding`,walletId:o,nearProjectionProfileId:r.value,nearAccountId:s,nearEd25519SigningKeyId:c,signerSlot:i.signerSlot,operationalPublicKey:l}}async function ye(e,t){return(await e.accountStore.getProfile(String(t)))?.nearProvisioning??null}async function be(e,t){let n=String(t.walletId||``).trim();if(!n)throw Error(`SeamsWalletDB: walletId is required`);let r=Date.now(),i=t.status===`near_ready`?{status:`near_ready`,updatedAtMs:r,nearAccountId:t.nearAccountId}:t.status===`near_failed_retryable`?{status:`near_failed_retryable`,updatedAtMs:r,error:t.errorCode,errorCode:t.errorCode}:{status:t.status,updatedAtMs:r};await e.accountStore.upsertProfile({profileId:n,nearProvisioning:i})}async function xe(e,t){let n=o(t.nearAccountId),r=c(t.walletId),i=y(t.signerSlot);if(!i)throw Error(`Authenticated wallet activation requires an exact signerSlot`);let a=await ve(e,{walletId:r,nearAccountId:n,signerSlot:i});await e.accountStore.setLastProfileStateForProfile(a.nearProjectionProfileId,a.signerSlot),e.userPreferencesManager.setCurrentWallet(a.walletId),await e.userPreferencesManager.reloadUserSettings().catch(()=>void 0),e.nonceCoordinator.initializeNearAccessKey({walletId:a.walletId,nearAccountId:a.nearAccountId,publicKey:a.operationalPublicKey}),t.nearClient&&e.nonceCoordinator.prefetchNearContext({kind:`initialized_state`,nearClient:t.nearClient}).catch(e=>console.debug(`Nonce prefetch after authentication state initialization failed (non-fatal):`,e))}async function Se(e,t){let n=Number(t.signerSlot);if(!Number.isSafeInteger(n)||n<1)throw Error(`SeamsWalletDB: authenticator signerSlot must be an integer >= 1`);let r={...t,nearAccountId:o(t.nearAccountId),signerSlot:n},i=await N(e,r.nearAccountId);if(!i?.profileId)throw Error(`SeamsWalletDB: Missing profile/account mapping for NEAR account ${r.nearAccountId}`);await e.accountStore.upsertProfileAuthenticator({profileId:i.profileId,signerSlot:r.signerSlot,credentialId:r.credentialId,credentialPublicKey:r.credentialPublicKey,transports:r.transports,name:r.name,registered:r.registered,syncedAt:r.syncedAt})}function Ce(e){let t=String(e).trim();return a(t)||t.split(`.`)[0]||``}function F(e){let t=Date.now();return{version:`wallet_auth_method_v1`,kind:`passkey`,status:`active`,localStatus:`synced`,walletId:e.walletId,rpId:e.rpId,credentialIdB64u:e.credentialId,credentialPublicKeyB64u:n(e.credentialPublicKey),counter:0,createdAtMs:t,updatedAtMs:t}}async function I(e){let n=String(e.walletId||``).trim(),r=String(e.email||``).trim().toLowerCase(),i=String(e.registrationAuthorityId||``).trim();if(!n||!r||!i)throw Error(`SeamsWalletDB: Email OTP auth method requires walletId, email, and registrationAuthorityId`);let a=await t(r);if(String(e.authority.walletId)!==n||e.authority.verifier.emailHashHex!==a)throw Error(`SeamsWalletDB: Email OTP auth method authority does not match wallet or email`);let o=Date.now();return{version:`wallet_auth_method_v1`,kind:`email_otp`,status:`active`,localStatus:`synced`,walletId:e.walletId,emailHashHex:a,registrationAuthorityId:i,authority:e.authority,createdAtMs:o,updatedAtMs:o}}async function we(e,t){let n=o(t),r=await N(e,n);r?.profileId&&await e.accountStore.deleteProfileData(r.profileId,{eventAccountId:n})}async function Te(e,t){return(await P(e,o(t))).length>0}function Ee(e){let t=e.activation.signer.metadata||{},n=e.activation.signer.signerKind,r=n===f.thresholdEcdsa?X(t.thresholdEcdsaPublicKeyB64u,`ECDSA key material publicKey`):X(t.operationalPublicKey,`Ed25519 key material publicKey`),i={profileId:X(e.activation.account.profileId,`profileId`),signerSlot:e.signerSlot,chainIdKey:X(e.activation.account.chainIdKey,`chainIdKey`),accountAddress:X(e.activation.account.accountAddress,`accountAddress`),signerId:X(e.activation.signer.signerId,`signerId`),keyKind:`threshold_share_v1`,algorithm:n===f.thresholdEcdsa?`secp256k1`:`ed25519`,publicKey:r,timestamp:e.timestamp,schemaVersion:1};return n===f.thresholdEd25519&&(i.payload={walletId:X(t.walletId,`walletId`),nearAccountId:X(t.nearAccountId,`nearAccountId`),nearEd25519SigningKeyId:X(t.nearEd25519SigningKeyId,`nearEd25519SigningKeyId`),relayerKeyId:X(t.relayerKeyId,`relayerKeyId`),keyVersion:X(t.keyVersion,`keyVersion`)}),i}function De(e){switch(e.mode.kind){case`fresh_registration`:return{mode:`fail_if_occupied`,signerSlot:e.signerSlot};case`wallet_recovery_replacement`:return{mode:`replace_slot`,signerSlot:e.signerSlot,replacedSignerKind:f.thresholdEd25519,revocationReason:`wallet_recovery_replacement`}}}function Oe(e){switch(e.mode.kind){case`fresh_registration`:return{mode:`allocate_next_free`};case`wallet_recovery_replacement`:return{mode:`replace_profile_chain_kind`,signerSlot:e.signerSlot,replacedSignerKind:f.thresholdEcdsa,revocationReason:`wallet_recovery_replacement`}}}function L(e){let t=Number(e.signerSlot);if(!Number.isSafeInteger(t)||t<1)throw Error(`SeamsWalletDB: wallet signerSlot must be an integer >= 1`);let n=String(e.walletId||``).trim();if(!n)throw Error(`SeamsWalletDB: walletId is required`);let r=o(e.nearAccountId),i=String(e.nearEd25519SigningKeyId||``).trim();if(!i)throw Error(`SeamsWalletDB: nearEd25519SigningKeyId is required`);return{signerSlot:t,walletId:n,nearAccountId:r,nearEd25519SigningKeyId:i}}function R(e,t,n){return{walletId:e.walletId,nearAccountId:String(e.nearAccountId),nearEd25519SigningKeyId:e.nearEd25519SigningKeyId,operationalPublicKey:t.operationalPublicKey,relayerKeyId:t.relayerKeyId,keyVersion:t.keyVersion,...n,...t.participantIds?{participantIds:t.participantIds}:{},...t.clientParticipantId==null?{}:{clientParticipantId:t.clientParticipantId},...t.relayerParticipantId==null?{}:{relayerParticipantId:t.relayerParticipantId}}}function z(e){let t=X(e.operationalPublicKey,`Ed25519 signerId`),{signerSlot:n,walletId:r,nearAccountId:i}=e.identity,a=r=>({input:{account:r,signer:{signerId:t,signerType:`threshold`,signerKind:f.thresholdEd25519,signerAuthMethod:e.source.signerAuthMethod,signerSource:e.source.signerSource,metadata:e.metadata},activationPolicy:e.activationPolicy,preferredSlot:n,mutation:{routeThroughOutbox:!1}},signerSlot:n});return[a({profileId:r,chainIdKey:`wallet`,accountAddress:r,accountModel:`wallet`}),a({profileId:e.nearProfileId,chainIdKey:S(i),accountAddress:m(i),accountModel:`near-native`})]}function B(e){let t=e.map(e=>e.input),n=Date.now();return{signerActivations:t,keyMaterials:e.map(e=>Ee({activation:e.input,signerSlot:e.signerSlot,timestamp:n}))}}function V(e,t,n,r){return t.kind===`near_ed25519_and_evm_family_ecdsa`?Q({walletId:e,walletKeys:t.walletKeys},n,r).signerActivations:[]}function H(e,t){return{chainTarget:e.chainTarget,targetKey:e.targetKey,signerSlot:t.signerSlot,signerId:e.signerId}}function ke(e,t,n){let r=String(e.credential.rawId||``).trim();if(!r)throw Error(`SeamsWalletDB: registration credential rawId is required`);let i=e.participantIds===void 0?void 0:Z(e.participantIds);return U({walletId:e.walletId,nearAccountId:e.nearAccountId,nearEd25519SigningKeyId:e.nearEd25519SigningKeyId,rpId:e.rpId,signerSlot:e.signerSlot,operationalPublicKey:e.operationalPublicKey,relayerKeyId:e.relayerKeyId,keyVersion:e.keyVersion,participantIds:i,clientParticipantId:e.clientParticipantId,relayerParticipantId:e.relayerParticipantId,credentialFacts:{credentialId:r,credentialDisplayId:e.credential.id,credentialPublicKey:M(e.credentialPublicKeyB64u,`credentialPublicKeyB64u`),transports:e.credential.response?.transports??[]}},t,n)}function U(e,t,n){let r=e.credentialFacts.credentialId,i=L(e),{signerSlot:a,walletId:o,nearAccountId:s}=i,c={id:e.credentialFacts.credentialDisplayId,rawId:r},l=new Date().toISOString(),u=g(s),{signerActivations:d,keyMaterials:f}=B([...z({identity:i,nearProfileId:u,operationalPublicKey:e.operationalPublicKey,source:A,metadata:R(i,e,{passkeyCredentialId:e.credentialFacts.credentialDisplayId,passkeyCredentialRawId:r}),activationPolicy:De({mode:t,signerSlot:a})}),...V(e.walletId,n,A,t)]);return{profiles:[o,u].map(e=>({profileId:e,defaultSignerSlot:a,passkeyCredential:c})),initialAuthMethod:F({walletId:e.walletId,rpId:e.rpId,credentialId:r,credentialPublicKey:e.credentialFacts.credentialPublicKey}),authenticators:[o,u].map(t=>({profileId:t,signerSlot:a,credentialId:r,credentialPublicKey:e.credentialFacts.credentialPublicKey,transports:[...e.credentialFacts.transports],name:`Passkey for ${Ce(s)}`,registered:l,syncedAt:l})),signerActivations:d,keyMaterials:f,lastProfileState:{profileId:o,activeSignerSlot:a}}}function Ae(e,t){let n=e.signerActivations[1];if(!n)throw Error(`SeamsWalletDB: wallet Ed25519 registration batch did not complete`);let r=[];for(let n=0;n<t.length;n+=1){let i=t[n],a=e.signerActivations[n+2];if(!i||!a)throw Error(`SeamsWalletDB: mixed wallet ECDSA registration batch did not complete`);r.push(H(i,a))}return{signerSlot:n.signerSlot,storedSigners:r}}function je(e){return W(ke(e,{kind:`fresh_registration`},{kind:`near_ed25519_only`}),e,e.participantIds,[e.custodyMaterial])}function Me(e){let t=String(e.credentialIdB64u||``).trim();if(!t)throw Error(`SeamsWalletDB: registration credential projection id is required`);return W(U({walletId:e.walletId,nearAccountId:e.nearAccountId,nearEd25519SigningKeyId:e.nearEd25519SigningKeyId,rpId:e.rpId,signerSlot:e.signerSlot,operationalPublicKey:e.operationalPublicKey,relayerKeyId:e.relayerKeyId,keyVersion:e.keyVersion,participantIds:e.participantIds,credentialFacts:{credentialId:t,credentialDisplayId:t,credentialPublicKey:M(e.credentialPublicKeyB64u,`credentialPublicKeyB64u`),transports:[...e.transports]}},{kind:`fresh_registration`},{kind:`near_ed25519_only`}),e,e.participantIds,[e.custodyMaterial])}function W(e,t,n,r){let i=o(t.nearAccountId),a=r.map(e=>{let r=e.binding;if(r.walletId!==String(t.walletId)||r.nearAccountId!==String(i)||r.nearEd25519SigningKeyId!==String(t.nearEd25519SigningKeyId)||r.signerSlot!==Number(t.signerSlot)||r.participantIds[0]!==n[0]||r.participantIds[1]!==n[1])throw Error(`Wallet custody Ed25519 material does not match registration identity`);return O({target:{profileId:String(g(i)),chainIdKey:S(i),accountAddress:m(i)},binding:r,sealed:e.sealed})}),s=e.lastProfileState;if(!s)throw Error(`Wallet Ed25519 registration publication requires last profile state`);return{profiles:e.profiles,initialAuthMethod:e.initialAuthMethod,authenticators:e.authenticators,signerActivations:e.signerActivations,keyMaterials:[...e.keyMaterials,...a],lastProfileState:{profileId:s.profileId,activeSignerSlot:s.activeSignerSlot,scope:s.scope??null}}}function G(e){let t=e[0];if(!t)throw Error(`SeamsWalletDB: threshold ECDSA walletKeys are required`);return[t,...e.slice(1)]}function Ne(e){switch(e){case`email_otp`:return j;case`passkey`:return A;default:return Pe(e)}}function Pe(e){throw Error(`Unsupported wallet ECDSA registration kind: ${String(e)}`)}async function K(e,t){let{signerActivations:n,keyMaterials:r}=B(Q({walletId:e.walletId,walletKeys:e.walletKeys},Ne(e.kind),t).signerActivations);switch(e.kind){case`passkey`:{let t=X(e.credentialIdB64u,`credentialIdB64u`),i=M(e.credentialPublicKeyB64u,`credentialPublicKeyB64u`),a=new Date().toISOString();return{profiles:[{profileId:e.walletId,defaultSignerSlot:1,passkeyCredential:{id:t,rawId:t}}],initialAuthMethod:F({walletId:e.walletId,rpId:e.rpId,credentialId:t,credentialPublicKey:i}),authenticators:[{profileId:e.walletId,signerSlot:1,credentialId:t,credentialPublicKey:i,transports:[...e.transports],name:`Passkey for wallet`,registered:a,syncedAt:a}],signerActivations:n,keyMaterials:r,lastProfileState:{profileId:e.walletId,activeSignerSlot:1,scope:null}}}case`email_otp`:return{profiles:[{profileId:e.walletId,defaultSignerSlot:1}],initialAuthMethod:await I({walletId:e.walletId,email:e.email,registrationAuthorityId:e.registrationAuthorityId,authority:e.authority}),authenticators:[],signerActivations:n,keyMaterials:r,lastProfileState:{profileId:e.walletId,activeSignerSlot:1,scope:null}}}}function q(e){return K(e,{kind:`fresh_registration`})}async function Fe(e){let t=X(e.credentialIdB64u,`credentialIdB64u`);return e.kind===`near_ed25519`?W(U({walletId:e.walletId,nearAccountId:e.nearAccountId,nearEd25519SigningKeyId:e.nearEd25519SigningKeyId,rpId:e.rpId,signerSlot:e.signerSlot,operationalPublicKey:e.operationalPublicKey,relayerKeyId:e.relayerKeyId,keyVersion:s,participantIds:Z(e.participantIds),credentialFacts:{credentialId:t,credentialDisplayId:t,credentialPublicKey:M(e.credentialPublicKeyB64u,`credentialPublicKeyB64u`),transports:e.transports}},{kind:`wallet_recovery_replacement`},e.walletKeys.length>0?{kind:`near_ed25519_and_evm_family_ecdsa`,walletKeys:e.walletKeys}:{kind:`near_ed25519_only`}),e,Z(e.participantIds),e.custodyMaterials):await K({kind:`passkey`,walletId:e.walletId,rpId:e.rpId,credentialIdB64u:t,credentialPublicKeyB64u:e.credentialPublicKeyB64u,transports:e.transports,walletKeys:G(e.walletKeys)},{kind:`wallet_recovery_replacement`})}async function Ie(e){return e.kind===`near_ed25519`?W(await Y({walletId:e.walletId,nearAccountId:e.nearAccountId,nearEd25519SigningKeyId:e.nearEd25519SigningKeyId,email:e.email,registrationAuthorityId:e.registrationAuthorityId,authority:e.authority,signerSlot:e.signerSlot,operationalPublicKey:e.operationalPublicKey,relayerKeyId:e.relayerKeyId,keyVersion:s,participantIds:Z(e.participantIds)},e.walletKeys.length>0?{kind:`near_ed25519_and_evm_family_ecdsa`,walletKeys:e.walletKeys}:{kind:`near_ed25519_only`},{kind:`wallet_recovery_replacement`}),e,Z(e.participantIds),e.custodyMaterials):await K({kind:`email_otp`,walletId:e.walletId,email:e.email,registrationAuthorityId:e.registrationAuthorityId,authority:e.authority,walletKeys:G(e.walletKeys)},{kind:`wallet_recovery_replacement`})}async function J(e,t,n,r){let i=ke(t,n,r);return Ae(await e.accountStore.persistWalletRegistrationFinalize(i),V(t.walletId,r,A))}async function Le(e,t){return{signerSlot:(await J(e,t,{kind:`fresh_registration`},{kind:`near_ed25519_only`})).signerSlot}}async function Re(e,t){return await J(e,t,{kind:`fresh_registration`},{kind:`near_ed25519_and_evm_family_ecdsa`,walletKeys:t.walletKeys})}async function ze(e,t){return{signerSlot:(await J(e,t,{kind:`wallet_recovery_replacement`},{kind:`near_ed25519_only`})).signerSlot}}async function Y(e,t,n={kind:`fresh_registration`}){let r=L(e),{signerSlot:i,walletId:a,nearAccountId:o}=r,s=g(o),{signerActivations:c,keyMaterials:l}=B([...z({identity:r,nearProfileId:s,operationalPublicKey:e.operationalPublicKey,source:j,metadata:R(r,e,{email:String(e.email||``).trim().toLowerCase(),registrationAuthorityId:String(e.registrationAuthorityId||``).trim()}),activationPolicy:De({mode:n,signerSlot:i})}),...V(e.walletId,t,j,n)]);return{profiles:[a,s].map(e=>({profileId:e,defaultSignerSlot:i})),initialAuthMethod:await I({walletId:e.walletId,email:e.email,registrationAuthorityId:e.registrationAuthorityId,authority:e.authority}),authenticators:[],signerActivations:c,keyMaterials:l,lastProfileState:{profileId:a,activeSignerSlot:i}}}async function Be(e,t,n){let r=await Y(t,n),i=await e.accountStore.persistWalletRegistrationFinalize(r),a=V(t.walletId,n,j),o=i.signerActivations[1];if(!o)throw Error(`SeamsWalletDB: wallet Email OTP Ed25519 registration batch did not complete`);let s=[];for(let e=0;e<a.length;e+=1){let t=a[e],n=i.signerActivations[e+2];if(!t||!n)throw Error(`SeamsWalletDB: mixed wallet Email OTP ECDSA registration batch did not complete`);s.push(H(t,n))}return{signerSlot:o.signerSlot,storedSigners:s}}async function Ve(e){return W(await Y(e,{kind:`near_ed25519_only`}),e,e.participantIds,[e.custodyMaterial])}async function He(e,t){return{signerSlot:(await Be(e,t,{kind:`near_ed25519_only`})).signerSlot}}async function Ue(e,t){return Be(e,t,{kind:`near_ed25519_and_evm_family_ecdsa`,walletKeys:t.walletKeys})}async function We(e,t){let n=String(t.auth.credential.rawId||t.auth.credential.id||``).trim();if(!n)throw Error(`SeamsWalletDB: add-signer credential id is required`);let r=L(t),{signerSlot:i,walletId:a,nearAccountId:o}=r,s={id:t.auth.credential.id,rawId:n},c=g(o),{signerActivations:l,keyMaterials:u}=B(z({identity:r,nearProfileId:c,operationalPublicKey:t.operationalPublicKey,source:A,metadata:R(r,t,{passkeyCredentialId:t.auth.credential.id,passkeyCredentialRawId:n}),activationPolicy:{mode:`fail_if_occupied`,signerSlot:i}})),d=await e.accountStore.persistWalletSignerFinalize({profiles:[a,c].map(e=>({profileId:e,defaultSignerSlot:i,passkeyCredential:s})),signerActivations:l,keyMaterials:u,lastProfileState:{profileId:a,activeSignerSlot:i}}),f=d.signerActivations[1];if(!f)throw Error(`SeamsWalletDB: wallet Ed25519 signer batch did not complete`);return{signerSlot:f.signerSlot,rollbackReceipt:d.rollbackReceipt}}async function Ge(e,t){await e.accountStore.rollbackWalletSignerFinalize(t)}function X(e,t){let n=String(e||``).trim();if(!n)throw Error(`SeamsWalletDB: ${t} is required`);return n}function Z(e){if(e.length!==2||e.some(e=>!Number.isSafeInteger(e)||e<1))throw Error(`SeamsWalletDB: Ed25519 participantIds must contain two positive integers`);return[e[0],e[1]]}function Ke(e){if(!Array.isArray(e)||e.length!==2||e[0]!==1||e[1]!==2)throw Error(`SeamsWalletDB: threshold ECDSA participantIds must be [1, 2]`);return[1,2]}function Q(e,t=A,n={kind:`fresh_registration`}){let r=X(e.walletId,`walletId`);if(!Array.isArray(e.walletKeys)||e.walletKeys.length===0)throw Error(`SeamsWalletDB: threshold ECDSA walletKeys are required`);let i=[];for(let a of e.walletKeys){if(a.keyScope!==`evm-family`)throw Error(`SeamsWalletDB: threshold ECDSA wallet keyScope must be evm-family`);let e=X(a.walletId,`wallet key walletId`);if(e!==r)throw Error(`SeamsWalletDB: threshold ECDSA wallet key walletId mismatch`);let o=X(a.keyHandle,`wallet key keyHandle`),s=X(a.ecdsaThresholdKeyId,`wallet key ecdsaThresholdKeyId`),c=X(a.signingRootId,`wallet key signingRootId`),u=X(a.signingRootVersion,`wallet key signingRootVersion`),d=X(a.relayerKeyId,`wallet key relayerKeyId`),h=X(a.thresholdEcdsaPublicKeyB64u,`wallet key thresholdEcdsaPublicKeyB64u`),g=Ke(a.participantIds),_=m(a.thresholdOwnerAddress);if(!_)throw Error(`SeamsWalletDB: wallet key thresholdOwnerAddress is required`);let v=p(a.chainTarget),y=l(a.chainTarget);i.push({chainTarget:a.chainTarget,targetKey:y,signerId:_,signerSlot:1,input:{account:{profileId:e,chainIdKey:v,accountAddress:_,accountModel:k},signer:{signerId:_,signerType:`threshold`,signerKind:f.thresholdEcdsa,signerAuthMethod:t.signerAuthMethod,signerSource:t.signerSource,metadata:{accountModel:k,accountAddress:_,ownerAddress:_,thresholdOwnerAddress:_,keyScope:a.keyScope,keyHandle:o,walletId:e,ecdsaThresholdKeyId:s,signingRootId:c,signingRootVersion:u,relayerKeyId:d,relayerVerifyingShareB64u:X(a.relayerVerifyingShareB64u,`wallet key relayerVerifyingShareB64u`),publicCapability:a.publicCapability,roleLocalMaterialRef:a.roleLocalMaterialRef,ecdsaRoleLocalPublicFacts:a.ecdsaRoleLocalPublicFacts,thresholdEcdsaPublicKeyB64u:h,participantIds:g,chainTarget:a.chainTarget,targetMembership:{targetKey:y,chainTarget:a.chainTarget},sharedEvmFamilyKey:{walletId:e,keyScope:a.keyScope,keyHandle:o,ecdsaThresholdKeyId:s,signingRootId:c,signingRootVersion:u,participantIds:g,thresholdOwnerAddress:_,thresholdEcdsaPublicKeyB64u:h},chainId:a.chainTarget.chainId}},activationPolicy:Oe({mode:n,signerSlot:1}),preferredSlot:1,mutation:{routeThroughOutbox:!1}}})}return{walletId:r,signerActivations:i}}function $(e,t){return e.accountStore.persistWalletSignerFinalize({profiles:[{profileId:t.walletId}],...B(t.signerActivations)})}async function qe(e,t){let n=Q(t),r=await $(e,n);return{storedSigners:n.signerActivations.map((e,t)=>{let n=r.signerActivations[t];if(!n)throw Error(`SeamsWalletDB: wallet ECDSA signer batch did not complete`);return H(e,n)})}}async function Je(e,t){let n=Q(t,A,{kind:`wallet_recovery_replacement`}),r=await $(e,n);return{storedSigners:n.signerActivations.map((e,t)=>{let n=r.signerActivations[t];if(!n)throw Error(`SeamsWalletDB: wallet recovery ECDSA signer batch did not complete`);return H(e,n)})}}async function Ye(e,t){let n=Q(t,j),r=await $(e,n);return{storedSigners:n.signerActivations.map((e,t)=>{let n=r.signerActivations[t];if(!n)throw Error(`SeamsWalletDB: wallet Email OTP ECDSA signer batch did not complete`);return H(e,n)})}}async function Xe(e,t){let n=String(t.credential.rawId||``).trim();if(!n)throw Error(`SeamsWalletDB: registration credential rawId is required`);let r=Q({walletId:t.walletId,walletKeys:t.walletKeys}),i=await q({kind:`passkey`,walletId:t.walletId,rpId:t.rpId,credentialIdB64u:n,credentialPublicKeyB64u:t.credentialPublicKeyB64u,transports:t.credential.response?.transports??[],walletKeys:G(t.walletKeys)}),a=await e.accountStore.persistWalletRegistrationFinalize(i);return{storedSigners:r.signerActivations.map((e,t)=>{let n=a.signerActivations[t];if(!n)throw Error(`SeamsWalletDB: wallet ECDSA registration batch did not complete`);return H(e,n)})}}async function Ze(e,t){let n=Q({walletId:t.walletId,walletKeys:t.walletKeys},j),r=await q({kind:`email_otp`,walletId:t.walletId,email:t.email,registrationAuthorityId:t.registrationAuthorityId,authority:t.authority,walletKeys:G(t.walletKeys)}),i=await e.accountStore.persistWalletRegistrationFinalize(r);return{storedSigners:n.signerActivations.map((e,t)=>{let n=i.signerActivations[t];if(!n)throw Error(`SeamsWalletDB: wallet Email OTP ECDSA registration batch did not complete`);return H(e,n)})}}export{Re as A,qe as C,Ye as D,Ze as E,ie as F,w as I,T as M,D as N,He as O,O as P,Je as S,Le as T,Ge as _,ue as a,Se as b,Te as c,Me as d,je as f,we as g,Fe as h,ce as i,E as j,Ue as k,P as l,Ie as m,Xe as n,le as o,Ve as p,We as r,ye as s,xe as t,q as u,me as v,ze as w,se as x,be as y};
@@ -0,0 +1 @@
1
+ import{D as e,M as t,O as n,T as r,V as i,d as a,h as o,j as s,k as c,l,r as ee,u,w as d,z as f}from"./domainIds-C3fUa33Q.js";import{C as te,k as p}from"./chains-CPmd4s9f.js";import{i as ne,r as re}from"./base64-BmKR3UqU.js";import{d as ie,h as ae,l as oe,m}from"./capabilityKinds-CqHVzVsJ.js";import{r as h}from"./canonicalPrimitives-D_1HyEuJ.js";function g(e,t={trim:!0}){let n=String(e??``);return i(t.trim?n.trim():n)}function _(e){let t=String(e.token??``).trim();if(!t)throw Error(e.missingMessage);return{Authorization:`Bearer ${t}`}}function se(e){return{method:`POST`,headers:{"Content-Type":`application/json`,...e.headers||{}},credentials:`omit`,body:e.bodyJson??JSON.stringify(e.body)}}function ce(e,t){let n=g(e),r=globalThis.location?.origin,i;try{i=new URL(n).origin}catch{return}if(!(!r||i===r))for(let e of t)fetch(`${n}${e}`,{method:`OPTIONS`,credentials:`omit`}).catch(()=>{})}function le(e){return{..._({token:e.token,missingMessage:`Wallet Session token is required`}),...v(e.home)}}function v(e){switch(e.kind){case`direct`:return{};case`regional`:return{"X-Seams-Wallet-Region":e.region}}}async function ue(e){let t=await fetch(e.clone());if(t.status!==409||!e.headers.has(`X-Seams-Wallet-Region`))return t;let n;try{n=await t.clone().json()}catch{return t}if(!te(n)||n.code!==`wallet_home_discovery_required`)return t;let r=new Headers(e.headers);return r.delete(`X-Seams-Wallet-Region`),fetch(new Request(e,{headers:r}))}const de=[1,2];function y(e){let t=Number(e);return!Number.isSafeInteger(t)||t<1||t>65535?null:t}function fe(e){if(!Array.isArray(e)||e.length===0)return null;let t=[],n=new Set;for(let r of e){let e=y(r);if(!e)return null;n.has(e)||(n.add(e),t.push(e))}return t.sort((e,t)=>e-t),t.length?t:null}function pe(e){if(!Array.isArray(e)||e.length===0)return null;let t=[];for(let n of e){if(!n||typeof n!=`object`||Array.isArray(n))return null;let e=n,r=y(e.id),i=f(e.role);if(!r||i!==`client`&&i!==`relayer`)return null;let a={id:r,role:i},o=f(e.relayerUrl);o&&(a.relayerUrl=o);let s=f(e.relayerKeyId);s&&(a.relayerKeyId=s);let c=f(e.shareDerivation);(c===`prf_first_v1`||c===`derived_master_secret_v1`||c===`kv_random_v1`||c===`unknown`)&&(a.shareDerivation=c),t.push(a)}return t.length?t:null}function me(e){let t=f(e.relayerKeyId),n=f(e.relayerUrl),r=y(e.clientParticipantId)??1,i=y(e.relayerParticipantId)??2;return[{id:r,role:`client`,shareDerivation:e.clientShareDerivation||`prf_first_v1`},{id:i,role:`relayer`,...n?{relayerUrl:n}:{},...t?{relayerKeyId:t}:{},...e.relayerShareDerivation?{shareDerivation:e.relayerShareDerivation}:{}}]}function b(e,t){let n=f(t);if(!n)throw Error(`${e} is required`);return n}function x(e){return`${b(`projectId`,e.projectId)}:${b(`envId`,e.envId)}`}function he(e){let t=ge(e);return{...t,signingRootVersion:b(`signingRootVersion`,t.signingRootVersion)}}function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`runtimePolicyScope must be an object`);let t=e;if(Object.prototype.hasOwnProperty.call(t,`environmentId`))throw Error(`runtimePolicyScope.environmentId is stale; use envId`);if(Object.prototype.hasOwnProperty.call(t,`runtimeSnapshotScope`))throw Error(`runtimePolicyScope.runtimeSnapshotScope is stale; use runtimePolicyScope`);return{orgId:b(`orgId`,t.orgId),projectId:b(`projectId`,t.projectId),envId:b(`envId`,t.envId),...f(t.signingRootVersion)?{signingRootVersion:f(t.signingRootVersion)}:{}}}function _e(e,t){return e.orgId===t.orgId&&e.projectId===t.projectId&&e.envId===t.envId&&e.signingRootVersion===t.signingRootVersion}function ve(e){return{signingRootId:x(e),signingRootVersion:b(`signingRootVersion`,e.signingRootVersion)}}const ye=[`prf`,`kek`,`seed`,`scalar`,`secretkey`,`privatekey`,`plaintext`,`recoverycode`,`clientroot`,`holdershare`];function S(e,t,n,r=[]){let i=new Set(t),a=new Set(r);for(let t of Object.keys(e)){if(i.has(t))continue;if(a.has(t))throw Error(`${n}.${t} is not part of ${n}`);let e=t.toLowerCase().replace(/_/g,``);throw!e.includes(`publickey`)&&ye.some(t=>e.includes(t))?Error(`${n}.${t} must never carry plaintext custody material`):Error(`${n}.${t} is not part of ${n}`)}}function C(e,t,n){let r=p(e,n);S(r,t,n);for(let e of t)if(!Object.prototype.hasOwnProperty.call(r,e)||r[e]===void 0)throw Error(`${n}.${e} is required`);return r}function w(...e){return Object.assign((t,n)=>{if(!e.includes(t))throw Error(`${n} is invalid`);return t},{literals:e})}function T(e,t){let n=Object.keys(e),r=[...n.filter(t=>`literals`in e[t]),...n.filter(t=>!(`literals`in e[t]))];return Object.assign((i,a)=>{let o=C(i,n,a),s=new Map;for(let t of r)s.set(t,e[t](o[t],`${a}.${t}`));let c=Object.fromEntries(n.map(e=>[e,s.get(e)]));return t?.(c,a),c},{shape:e})}function E(e,t){let n=new Map;for(let r of t)for(let t of r.shape[e].literals)n.set(t,r);return(t,r)=>{let i=p(t,r),a=n.get(i[e]);if(!a)throw Error(`${r}.${e} is invalid`);return a(i,r)}}function D(e){return(t,n)=>t===null?null:e(t,n)}function O(e){return(t,n)=>{let r=e(t);if(r.ok)return r.value;throw Error(`${n} ${r.error.message}`)}}function k(e){return(t,n)=>{try{return e(t)}catch(e){throw Error(`${n} ${e instanceof Error?e.message:`is invalid`}`)}}}const A=Object.freeze([`export_keys`,`link_devices`,`revoke_devices`,`sign`]);Object.freeze([`sign`]);const j=new Set([`export_keys`,`link_devices`,`revoke_devices`,`sign`]),M=Symbol(`canonicalPermissionSetBrand`);var N=class e extends Array{[M]=!0;constructor(e){super(...e),Object.freeze(this)}static create(t){return new e(t)}static get[Symbol.species](){return Array}};function P(e){return typeof e==`string`&&j.has(e)}function F(e){if(!Array.isArray(e))return L(e==null?`delegated wallet permissions are required`:`delegated wallet permissions must be an array`);if(e.length===0)return L(`delegated wallet permissions must be non-empty`);let t=[],n=new Set;for(let r of e){if(!P(r))return L(`delegated wallet permission is unsupported`);if(n.has(r))return L(`delegated wallet permission ${r} is duplicated`);n.add(r),t.push(r)}return t.sort(De),{ok:!0,value:N.create(Oe(t))}}function I(e){return{kind:`delegated_wallet_authority_v1`,permissions:e.permissions}}function be(e){if(!ke(e))return R(`delegated wallet authority must contain exactly kind and permissions`);if(e.kind!==`delegated_wallet_authority_v1`)return R(`delegated wallet authority kind is unsupported`);let t=F(e.permissions);return t.ok?{ok:!0,value:I({permissions:t.value})}:t}function xe(){return Ee(A)}function Se(){return I({permissions:xe()})}function Ce(e,t){return e.permissions.includes(t)}function we(e){return Object.freeze([...e.permissions])}function Te(e,t){if(e.kind!==t.kind||e.permissions.length!==t.permissions.length)return!1;for(let n=0;n<e.permissions.length;n+=1)if(e.permissions[n]!==t.permissions[n])return!1;return!0}function Ee(e){let t=F(e);if(!t.ok)throw Error(t.error.message);return t.value}function De(e,t){return e<t?-1:e>t?1:0}function Oe(e){let[t,...n]=e;if(!t)throw Error(`delegated wallet permissions must be non-empty`);return[t,...n]}function ke(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.keys(e);return t.length===2&&t.includes(`kind`)&&t.includes(`permissions`)}function L(e){return{ok:!1,error:{code:`invalid`,message:e}}}function R(e){return{ok:!1,error:{code:`invalid`,message:e}}}const Ae=/^[A-Za-z0-9_-]+$/;function z(e,t){if(typeof e!=`string`||!Ae.test(e))throw Error(`${t} must be unpadded base64url`);let n;try{n=re(e)}catch{throw Error(`${t} must be valid base64url`)}if(ne(n)!==e)throw Error(`${t} must be canonical base64url`);return n}function je(e,t){if(e.ok)return e.value;throw Error(`${t} ${e.error.message}`)}function Me(e,t){try{return h(e)}catch(e){throw Error(`${t} ${e instanceof Error?e.message:`is not a digest`}`)}}function Ne(e,t=`nonceB64u`){if(z(e,t).length!==12)throw Error(`${t} must decode to a 12-byte ChaCha20Poly1305 nonce`);return e}function Pe(e,t=`ciphertextB64u`){if(z(e,t).length<17)throw Error(`${t} must decode to sealed ciphertext with an authentication tag`);return e}function Fe(e,t=`registeredPublicKeyB64u`){if(z(e,t).length!==32)throw Error(`${t} must decode to a 32-byte Ed25519 public key`);return e}function Ie(e,t=`publicKey33B64u`){let n=z(e,t);if(n.length!==33)throw Error(`${t} must decode to a 33-byte compressed secp256k1 point`);if(n[0]!==2&&n[0]!==3)throw Error(`${t} must be a compressed secp256k1 public key`);return e}function Le(e,t=`keyCreationSignerSlot`){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0||e>4294967295)throw Error(`${t} must be a positive u32`);return e}function Re(e,t=`envelopeRevision`){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0)throw Error(`${t} must be a positive integer revision`);return e}function B(e,t){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0)throw Error(`${t} must be a positive unix-millisecond timestamp`);return e}const ze=O(l),V=O(n),Be=O(u),Ve=O(a),He=O(oe),Ue=O(c),H=O(ae),U=O(m),W=O(r),G=O(e),We=O(s),Ge=O(t),Ke=O(ie),qe=O(o),K=k(h),Je=D(Y);function q(e){return(t,n)=>e(t,n.slice(n.lastIndexOf(`.`)+1))}function J(e,t){try{return B(e,t)}catch(e){throw Error(e instanceof Error?e.message:`${t} is invalid`)}}function Y(e,t){if(typeof e!=`string`||e.length===0||e.trim()!==e)throw Error(`${t} must be a non-empty canonical string`);for(let n of e){let e=n.charCodeAt(0);if(/\s/.test(n)||e<=31||e===127)throw Error(`${t} must not contain whitespace or control characters`)}return e}function X(e,t){if(!Number.isSafeInteger(e)||Number(e)<0)throw Error(`${t} must be a non-negative safe integer`);return Number(e)}function Ye(e,t){let n=be(e);if(!n.ok)throw Error(`${t}: ${n.error.message}`);return n.value}function Xe(e,t){let n=d(e);if(!n.ok)throw Error(`${t} ${n.error.message}`);return n.value}function Ze(e,t){if(e.kind!==t.kind||e.walletId!==t.walletId||e.authorityId!==t.authorityId||e.authMethodId!==t.authMethodId||e.authorizationId!==t.authorizationId||e.quotaId!==t.quotaId||e.authorityDigestB64u!==t.authorityDigestB64u||e.authorityRevocationEpoch!==t.authorityRevocationEpoch||e.issuedAtMs!==t.issuedAtMs||e.expiresAtMs!==t.expiresAtMs||e.capabilitySubjects.length!==t.capabilitySubjects.length)return!1;for(let n=0;n<e.capabilitySubjects.length;n+=1){let r=e.capabilitySubjects[n],i=t.capabilitySubjects[n];if(!r||!i||!Z(r,i))return!1}return!0}function Z(e,t){switch(e.kind){case`link_devices`:case`revoke_devices`:return t.kind===e.kind;case`sign`:case`export_keys`:return t.kind===e.kind&&t.keyFamily===e.keyFamily&&ee(e.materialActivation,t.materialActivation);default:return!1}}function Qe(e,t){for(let n of e.capabilitySubjects){let e=!1;for(let r of t.capabilitySubjects)if(Z(n,r)){e=!0;break}if(!e)return!1}return!0}const Q=E(`kind`,[T({kind:w(`direct`)}),T({kind:w(`regional`),region:w(`US`,`WEUR`,`APAC`,`OC`)})]);function $(e){return Q(e,`Wallet Session home`)}function $e(){return T({kind:w(`opaque_wallet_session_operation_credential_v1`),ownershipGeneration:X,home:$,token:(e,t)=>{if(typeof e!=`string`||e.length>8192)throw Error(`${t} is invalid`);return e},walletSessionId:q(H)},(e,t)=>{if(e.ownershipGeneration===0)throw Error(`${t} ownership generation must be positive`);if(!/^wst_[A-Za-z0-9_-]{43}$/.test(e.token))throw Error(`${t} opaque token is invalid`)})}function et(e){return $e()(e,`WalletSessionOperationCredentialV1`)}function tt(e){return e.kind===`sign`||e.kind===`export_keys`?`${e.kind}:${e.keyFamily}:${e.materialActivation.activationId}`:e.kind}function nt(){return T({kind:w(`active_wallet_session_v1`),walletId:q(V),authorityId:q(G),authMethodId:q(W),authorizationId:q(U),quotaId:q(Ke),authorityDigestB64u:q(K),authorityRevocationEpoch:q(X),capabilitySubjects:(e,t)=>{if(!Array.isArray(e)||e.length===0)throw Error(`${t} must be non-empty`);let n=[];for(let[t,r]of e.entries())n.push(it(r,`capabilitySubjects[${t}]`));let r=n[0];if(!r)throw Error(`${t} must be non-empty`);return[r,...n.slice(1)]},issuedAtMs:q(J),expiresAtMs:q(J)},(e,t)=>{let n=e.capabilitySubjects.map(tt);if(new Set(n).size!==n.length)throw Error(`${t} capability subjects repeat`)})}function rt(e){return nt()(e,`ActiveWalletSessionV1`)}function it(e,t){let n=p(e,t);if(n.kind===`link_devices`||n.kind===`revoke_devices`)return S(n,[`kind`],t),{kind:n.kind};if(n.kind!==`sign`&&n.kind!==`export_keys`)throw Error(`${t}.kind is invalid`);if(S(n,[`kind`,`keyFamily`,`materialActivation`],t),n.keyFamily!==`ed25519`&&n.keyFamily!==`ecdsa_secp256k1`)throw Error(`${t}.keyFamily is invalid`);return{kind:n.kind,keyFamily:n.keyFamily,materialActivation:qe(n.materialActivation,`${t}.materialActivation`)}}export{fe as $,Re as A,w as B,Ue as C,Fe as D,Me as E,Se as F,C as G,T as H,we as I,he as J,S as K,Ce as L,Ie as M,B as N,Pe as O,je as P,me as Q,F as R,V as S,H as T,O as U,D as V,E as W,ve as X,_e as Y,de as Z,J as _,Qe as a,ue as at,W as b,K as c,Ve as d,pe as et,Je as f,Xe as g,X as h,et as i,le as it,Le as j,Ne as k,Be as l,Y as m,rt as n,se as nt,He as o,g as ot,Ye as p,x as q,$ as r,v as rt,We as s,ce as st,Ze as t,_ as tt,q as u,Ge as v,U as w,G as x,ze as y,Te as z};
@@ -0,0 +1,2 @@
1
+ import{R as e}from"./domainIds-C3fUa33Q.js";import{S as t,T as n,i as r,x as i}from"./chains-CPmd4s9f.js";import{r as a}from"./transactionReviewAdmission-CNNho8IG.js";import{a as o,o as s,r as c,t as l}from"./errors-CI1xdN0d.js";import{p as u}from"./nonceLaneKeys-CR2XEvnk.js";import{u as d}from"./trace-CWTzEALZ.js";import{c as f,i as p,l as m,o as h,r as g,u as ee}from"./intentDigest--FZ63NBy.js";import{t as te}from"./surface-measurement-reporter-F-fVB7d3.js";import{n as _}from"./NonceCoordinator-Do23iTzQ.js";import{t as v}from"./collectAuthenticationCredentialForChallengeB64u-CSwy9csE.js";import{o as y,t as b}from"./types-BNUuaUtl.js";import{t as x}from"./promptText-D2f5Rg0h.js";import{i as S,n as ne,r as re,t as ie}from"./appearance-ZGVLwA4N.js";import{a as ae}from"./transaction-activity-D5f-Yn9t.js";import{a as C,c as oe,d as w,f as T,h as E,l as D,m as se,n as O,o as k,p as A,s as j,t as ce,u as M}from"./appearance-token-vars-Bu6YUWmf.js";import{i as le,n as ue,r as de,t as fe}from"./ConfirmationDrawer-B7RCp58z.js";function pe(e){return e===`drawer`?`drawer`:`modal`}function me(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))}function he(e){if(e?.uiMode===`none`)return{kind:`silent`,uiMode:`none`};let t=pe(e?.uiMode);return e?.behavior===`skipClick`?{kind:`auto_proceed`,uiMode:t,behavior:`skipClick`,autoProceedDelay:me(e.autoProceedDelay)}:{kind:`interactive`,uiMode:t,behavior:`requireClick`}}function ge(){return{kind:`silent`,uiMode:`none`}}function _e(e){throw Error(`Unsupported confirmation config: ${String(e.kind)}`)}function ve(e){if(e.type!==S.SIGN_TRANSACTION)return;let t=e.payload;if(t.signingKind!==`transaction`)return;let{subject:n,operation:r,signatureUses:i}=t.nearFundingRequest;if(n.walletId!==t.walletId||n.nearAccountId!==t.rpcCall.nearAccountId||n.nearPublicKeyStr!==t.nearPublicKeyStr)throw Error(`Invalid secure confirm request: NEAR funding subject mismatch`);if(r.accountId!==n.nearAccountId)throw Error(`Invalid secure confirm request: NEAR funding operation account mismatch`);if(!Number.isInteger(i)||i<1)throw Error(`Invalid secure confirm request: invalid NEAR funding signature use count`)}function ye(e){if(e.type!==S.SIGN_TRANSACTION&&e.type!==S.SIGN_NEP413_MESSAGE)return;let t=e.payload;if(t.prfOutput!==void 0)throw Error(`Invalid secure confirm request: forbidden signing payload field prfOutput`);if(t.wrapKeySeed!==void 0)throw Error(`Invalid secure confirm request: forbidden signing payload field wrapKeySeed`);if(t.wrapKeySalt!==void 0)throw Error(`Invalid secure confirm request: forbidden signing payload field wrapKeySalt`)}function be(e){switch(e.type){case S.SIGN_TRANSACTION:return N(e).rpcCall.nearAccountId;case S.SIGN_NEP413_MESSAGE:return e.payload.nearAccountId;case S.SIGN_INTENT_DIGEST:{let t=Ce(e);return t.kind===`near_wallet`?t.nearAccountId:``}case S.REGISTER_ACCOUNT:case S.LINK_DEVICE:return String(Ae(e).nearAccountId||``).trim();case S.AUTHORIZE_KEY_EXPORT:{let t=xe(e);return t.kind===`near_wallet`?t.nearAccountId:``}case S.SHOW_SECURE_PRIVATE_KEY_UI:{let t=xe(e);return t.kind===`near_wallet`?t.nearAccountId:``}default:return``}}function xe(e){if(e.type!==S.AUTHORIZE_KEY_EXPORT&&e.type!==S.SHOW_SECURE_PRIVATE_KEY_UI)throw Error(`Expected local key export request, got ${e.type}`);return e.payload.subject}function Se(e){let t=xe(e);switch(t.kind){case`near_wallet`:return t.nearAccountId;case`evm_wallet`:return t.walletId;default:{let e=t;throw Error(`Unsupported local key export subject: ${String(e)}`)}}}function Ce(e){if(e.type!==S.SIGN_INTENT_DIGEST)throw Error(`Expected SIGN_INTENT_DIGEST request, got ${e.type}`);return e.payload.signingSubject}function we(e){switch(e.type){case S.SIGN_TRANSACTION:return String(N(e).walletId||``).trim();case S.SIGN_NEP413_MESSAGE:return String(e.payload.walletId||``).trim();case S.REGISTER_ACCOUNT:case S.LINK_DEVICE:return String(Ae(e).walletId||``).trim();case S.SIGN_INTENT_DIGEST:return Ce(e).walletId;case S.AUTHORIZE_KEY_EXPORT:case S.SHOW_SECURE_PRIVATE_KEY_UI:return Se(e);default:return be(e)}}function Te(e){return e.type===S.SIGN_TRANSACTION&&N(e).txSigningRequests?.length||1}function Ee(e){return e.type===S.SIGN_TRANSACTION?e.payload.intentDigest:e?.intentDigest}function N(e){if(e.type!==S.SIGN_TRANSACTION)throw Error(`Expected SIGN_TRANSACTION request, got ${e.type}`);return e.payload}function De(e){if(e.type===S.SIGN_TRANSACTION)return N(e).displayModel;if(e.type===S.SIGN_NEP413_MESSAGE||e.type===S.SIGN_INTENT_DIGEST)return e.payload.displayModel}function Oe(e){if(e.type===S.SIGN_TRANSACTION)return y(N(e).signingAuthPlan);if(e.type===S.SIGN_NEP413_MESSAGE){let t=e.payload;return y(t.signingAuthPlan)}if(e.type===S.SIGN_INTENT_DIGEST){let t=e.payload;return y(t.signingAuthPlan)}}function ke(e){if(e.type===S.SIGN_TRANSACTION){let t=N(e);return t.signingAuthPlan?.kind===b.EmailOtpReauth?t.signingAuthPlan.emailOtpPrompt:t.emailOtpPrompt}if(e.type===S.SIGN_NEP413_MESSAGE){let t=e.payload;return t.signingAuthPlan?.kind===b.EmailOtpReauth?t.signingAuthPlan.emailOtpPrompt:t.emailOtpPrompt}if(e.type===S.SIGN_INTENT_DIGEST){let t=e.payload;return t.signingAuthPlan?.kind===b.EmailOtpReauth?t.signingAuthPlan.emailOtpPrompt:t.emailOtpPrompt}}function Ae(e){if(e.type!==S.REGISTER_ACCOUNT&&e.type!==S.LINK_DEVICE)throw Error(`Expected REGISTER_ACCOUNT or LINK_DEVICE request, got ${e.type}`);return e.payload}function je(e){if(typeof e==`string`){let n=e.trim();if(!n)return{};try{let e=JSON.parse(n);return t(e)&&!Array.isArray(e)?e:{}}catch{return{}}}if(!t(e)||Array.isArray(e))throw Error(`Invalid secure confirm request summary: expected an object`);return e}function Me(e){if(e==null)return e;if(Array.isArray(e))return e.map(e=>e);if(t(e)){let t=e,n={};for(let e of Object.keys(t)){if(e===`_confirmHandle`)continue;let r=t[e];i(r)||(n[e]=r)}return n}return e}const Ne={cancelled:`User cancelled secure confirm request`,collectCredentialsFailed:`Failed to collect credentials`,nearRpcFailed:`Failed to fetch NEAR data`};function Pe(t){return e(t.channelToken)}function Fe(t,n){let r=e(n?.channelToken);return!r&&!n?.onDecision?t:{postMessage:t.postMessage.bind(t),...r?{channelToken:r}:{},...n?.onDecision?{onDecision:n.onDecision}:{}}}function Ie(t,r,i){let{_confirmHandle:a,...o}=r,s=n(o.requestId)?o.requestId:r.requestId,c=e(i?.channelToken)??Pe(t),l={type:re.USER_PASSKEY_CONFIRM_RESPONSE,requestId:s,data:o,...c?{channelToken:c}:{}};t.onDecision?.(o),t.postMessage(l)}function Le(t,r,i){let a=Me(r),o=n(a?.requestId)?a.requestId:r.requestId,s=e(i?.channelToken)??Pe(t),c={type:re.USER_PASSKEY_CONFIRM_PROGRESS,requestId:o,data:a,...s?{channelToken:s}:{}};t.postMessage(c)}function Re(e){return o(e)?!1:c(e)||(()=>{let t=s(e);return t?.name===`NotAllowedError`||t?.name===`AbortError`})()}let ze=!1;function Be(e=!0){ze=!!e}function Ve(){return ze}function He(e){if(!e)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t,2)}catch{return String(e)}}function P(e){if(!e||e===`0`)return`0 NEAR`;try{let t=BigInt(e),n=BigInt(`1000000000000000000000000`),r=t/n,i=t%n;if(i===BigInt(0))return`${r.toString()} NEAR`;let a=i.toString().padStart(24,`0`).slice(0,5);return a=a.replace(/0+$/g,``),a.length===0?`${r.toString()} NEAR`:`${r.toString()}.${a} NEAR`}catch{return e}}function Ue(e){if(!e)return``;try{return`${BigInt(e)/BigInt(`1000000000000`)} Tgas`}catch{return e}}function F(e,t={}){if(!e||typeof e!=`string`)return``;let{prefix:n=12,suffix:r=6}=t;return e.length<=n+r+3?e:`${e.slice(0,n)}...${e.slice(-r)}`}function I(e){return e?e instanceof Uint8Array?`${e.byteLength} bytes`:Array.isArray(e)||typeof e==`string`?`${e.length} bytes`:`unknown`:`0 bytes`}function We(e){if(!e)return;let t=String(e.decoded||``),n=String(e.raw||``);if(!(!t||!n)&&t!==n)return{decoded:t,raw:n,defaultMode:e.defaultMode===`raw`?`raw`:`decoded`}}function Ge(e,t){if(!/Value \(wei\)$/i.test(e.trim()))return!1;let n=t.trim();if(!n)return!1;if(n===`0`||/^0x0+$/i.test(n))return!0;try{return BigInt(n)===0n}catch{return!1}}function Ke(e,t){return!Array.isArray(t)||t.length===0?[]:t.flatMap((t,n)=>{let r=String(t.label||``).trim(),i=String(t.value||``),a=t.renderAs||`inline`;if(Ge(r,i))return[];if(a===`file-content`){let a=We(t.contentVariants),o=a?.defaultMode===`raw`?a.raw:a?.decoded||i;return[{id:`${e}-field-${n}`,label:r?`${r}:`:``,fieldLabel:r?`${r}:`:void 0,type:`file`,open:!1,content:o,...a?{contentVariants:a}:{},copyValue:typeof t.copyValue==`string`?t.copyValue:void 0,hideLabel:!!t.hideLabel,hideChevron:typeof t.hideChevron==`boolean`?t.hideChevron:!0}]}return[{id:`${e}-field-${n}`,label:r?`${r}: ${i}`:i,fieldLabel:r?`${r}:`:void 0,type:`file`,open:!1,copyValue:typeof t.copyValue==`string`?t.copyValue:void 0}]})}const qe=({operation:e,depth:t,path:n,renderChild:r})=>{let i=String(e.id||``).trim()||`op-${n}`,a=(()=>{let t=String(e.to||``).trim();return/^0x[0-9a-fA-F]{40}$/.test(t)?t:void 0})(),o=String(e.description||``).trim(),s=Array.isArray(e.children)?e.children.map((e,i)=>r(e,t+1,`${n}.${i}`)):[],c=Ke(i,e.fields),l=o?[{id:`${i}-description`,label:o,type:`file`,open:!1}]:[];if(e.kind===`raw.fallback`){let t=String(e.raw||``).trim();t&&l.push({id:`${i}-raw`,label:`Raw payload`,type:`file`,open:!1,content:t})}let u=[...l,...c,...s];return u.length===0?{id:i,label:String(e.label||e.kind),type:`file`,open:!1,contractAddress:a}:{id:i,label:String(e.label||e.kind),type:`folder`,open:t<1,contractAddress:a,children:u}};function Je(e){switch(e){case`near`:return`NEAR`;case`evm`:return`EVM`;case`tempo`:return`Tempo`;default:return`Unknown`}}function Ye(e){return!Array.isArray(e)||e.length===0?[]:[{id:`warnings-root`,label:`Warnings`,type:`folder`,open:!0,children:e.map((e,t)=>({id:`warning-${t}`,label:`[${String(e.severity||`warning`).toUpperCase()}] ${String(e.message||``)}`,type:`file`,open:!1}))}]}function Xe(e,t,n){return qe({operation:e,depth:t,path:n,renderChild:(e,t,n)=>Xe(e,t,n)})}function Ze(e){let t=Array.isArray(e.children)?e.children.map(e=>Ze(e)):void 0;return e.type===`folder`?{...e,hideChevron:!0,children:t}:t?{...e,children:t}:e}function Qe(e,t){let n=Array.isArray(e.children)?e.children.map(e=>Qe(e,t)):void 0;return{...e,chain:t,...n?{children:n}:{}}}function $e(e){let t=e.chain===`evm`||e.chain===`tempo`,n=(Array.isArray(e.operations)?e.operations:[]).map((e,t)=>Xe(e,0,String(t))).map(t=>Qe(t,e.chain)).map(e=>t?Ze(e):e),r=[...Ye(e.warnings).map(t=>Qe(t,e.chain)).map(e=>t?Ze(e):e),...n];r.length===0&&r.push({id:`no-operations`,label:`No operations`,type:`file`,open:!1});let i=Je(e.chain);return{id:`display-root`,label:String(e.title||``).trim()||`${i} Transaction`,type:`folder`,open:!0,children:r}}function et(e,t){let r;switch(e.type){case`FunctionCall`:r=[{id:`a${t}-args`,label:`using args:`,type:`file`,open:!1,hideChevron:!0,hideLabel:!0,content:He(e.args)}];break;case`Transfer`:r=[];break;case`CreateAccount`:r=[];break;case`DeployContract`:{let n=I(e.code);r=[{id:`a${t}-code-size`,label:`WASM contract code size: ${n}`,type:`file`,open:!1}];break}case`DeployGlobalContract`:{let n=e.code,i=e.deployMode,a=I(n);r=[{id:`a${t}-deploy-mode`,label:`mode: ${String(i||``)}`,type:`file`,open:!1},{id:`a${t}-code-size`,label:`WASM global contract code size: ${a}`,type:`file`,open:!1}];break}case`UseGlobalContract`:{let n=e.accountId,i=e.codeHash,a;a=n?`by account: ${String(n)}`:i?`by hash: ${F(String(i),{prefix:10,suffix:6})}`:`by global contract identifier`,r=[{id:`a${t}-identifier`,label:a,type:`file`,open:!1}];break}case`Stake`:r=[{id:`a${t}-publicKey`,label:`validator: ${F(e.publicKey)}`,type:`file`,open:!0,copyValue:e.publicKey}];break;case`AddKey`:{let i=e.accessKey,a=``;try{a=(n(i)?JSON.parse(i):i).permission===`FullAccess`?`Full Access`:`Function Call`}catch{a=`Unknown`}r=[{id:`a${t}-publicKey`,label:`key: ${F(e.publicKey)}`,open:!1,type:`file`,copyValue:e.publicKey},{id:`a${t}-permissions`,label:`permissions: ${a}`,open:!1,type:`file`}];break}case`DeleteKey`:r=[{id:`a${t}-publicKey`,label:`key: ${F(e.publicKey)}`,open:!1,type:`file`,copyValue:e.publicKey}];break;case`DeleteAccount`:r=[{id:`a${t}-beneficiaryId`,label:`sending balance to: ${e.beneficiaryId}`,open:!1,type:`file`}];break;default:return tt(e)}return{id:`action-${t}`,label:``,type:`folder`,open:!1,hideChevron:!0,action:e,actionIndex:t,children:r}}function tt(e){throw Error(`Unsupported NEAR action: ${String(e)}`)}function nt(e,t,n){let r=e.actions.map((e,t)=>et(e,t));return{id:`tx-${t}`,label:``,type:`folder`,open:!0,hideChevron:!0,transaction:e,transactionIndex:t,totalTransactions:n,children:[...r]}}function rt(e){let t=e.length,n=e.map((e,n)=>nt(e,n,t));return{id:`txs-root`,label:t>1?`Transactions`:`Transaction`,type:`folder`,open:!0,children:n}}function it(e){let t=e.abiDecodeHint;if(t&&Array.isArray(t.abi)&&t.abi.length>0){let e=String(t.dataHex||``).trim();if(e&&e!==`0x`)return!0}return(Array.isArray(e.children)?e.children:[]).some(it)}function at(e){return(Array.isArray(e.operations)?e.operations:[]).some(it)}function L(e){let t=Array.isArray(e.txSigningRequests)?e.txSigningRequests:[];if(t.length>0)return rt(f(t));let n=e.model;if(!n)return null;let r=Array.isArray(n.operations)?n.operations:[],i=Array.isArray(n.warnings)?n.warnings:[];return r.length>0||i.length>0?$e(n):null}const ot=/^NEAR account ([^\s]+) needs funding before signing\.$/;function st(e){let t=String(e||``).trim();return t.length<=8?t:`${t.slice(0,4)}...${t.slice(-4)}`}function ct(e){let t=String(e||``).trim();return t?`NEAR account ${t} needs funding before signing.`:`NEAR account needs funding before signing.`}function lt(e){let t=String(e||``).trim(),n=ot.exec(t);if(!n)return null;let r=String(n[1]||``).trim();return r?{accountId:r,shortAccountId:st(r)}:null}function ut(e){return String(e||``).trim()===`Topping up account...`}function dt(e){let t=st(e);return t?`Funding NEAR account ${t}...`:`Funding NEAR account...`}function ft(e){let t=String(e||``).trim();return t.startsWith(`Funding NEAR account`)&&t.endsWith(`...`)}function pt(e){return ut(e)||ft(e)}function mt(e){let t=e.trim();if(!t)return{kind:`empty`};if(pt(t))return{kind:`status`,text:t};let n=lt(t);return n?{kind:`funding`,accountId:n.accountId,shortAccountId:n.shortAccountId}:{kind:`text`,text:t}}function ht(e){let t=e.presentation,n=t.errorMessage??``,r=t.cancelText??`Cancel`,i=t.securityContext?.passkeyRegistration;if(i?.kind===`passkey_registration_confirm_display_v1`)return{ok:!0,model:{appearance:e.appearance,content:{kind:`registration`,registration:{display:i,heading:t.title?.trim()||`Create your passkey`,body:t.body?.trim()||`Use Touch ID or your device passkey to create credentials for this account.`,cancelText:r,errorMessage:n,decision:t.loading?{kind:`creating`}:{kind:`ready`,onConfirm:e.callbacks.confirm},onCancel:e.callbacks.cancel}}}};let a;switch(t.signingAuthMode){case`emailOtp`:{let r=t.emailOtpPrompt,i=r?.challengeId.trim();if(!r||!i)return{ok:!1,error:`missing_email_challenge`};a={kind:`email`,email:{prompt:{challengeId:i,title:r.title,body:r.body,helperText:r.helperText,emailHint:r.emailHint,resendDebounceMs:r.resendDebounceMs,onResend:r.onResend},verification:gt(t.loading===!0,n),onSubmit:e.callbacks.submitEmail}};break}case`warmSession`:a={kind:`session`};break;case`webauthn`:case void 0:a={kind:`passkey`};break;default:return xt(t.signingAuthMode)}let o=mt(t.body??``);return{ok:!0,model:{appearance:e.appearance,content:{kind:`transaction`,review:{model:t.model??null,tree:e.tree},header:{heading:_t(t),website:vt(t.securityContext?.rpId?.trim()??``),chainDetails:yt(t,t.loading===!0||o.kind===`status`),errorMessage:n},body:o,prompt:a,transaction:{tree:e.tree,theme:e.appearance.theme.mode,explorers:{near:t.nearExplorerUrl||`https://testnet.nearblocks.io`,tempo:t.tempoExplorerUrl,evm:t.evmExplorerUrl},decision:t.loading||t.preparing?{kind:`preparing`}:{kind:`ready`,onConfirm:e.callbacks.confirm},confirmText:t.signingAuthMode===`emailOtp`?`Confirm Code`:t.confirmText??`Confirm`,cancelText:r,errorMessage:n,onCancel:e.callbacks.cancel,onBack:t.onBack}}}}}function gt(e,t){return e?{kind:`pending`}:t?{kind:`rejected`,message:t}:{kind:`ready`}}function _t(e){let t=(e.model?.operations.length??0)===0?`Register with Passkey`:`Confirm with Passkey`;switch(e.signingAuthMode){case`emailOtp`:return e.emailOtpPrompt?.title?.trim()||`Enter email code to sign`;case`warmSession`:return`Review transaction`;case`webauthn`:return t;case void 0:return e.title?.trim()||t;default:return xt(e.signingAuthMode)}}function vt(e){return e?{kind:`ready`,text:e}:{kind:`loading`}}function yt(e,t){let n=e.model;if(n?.chainId)return{kind:`ready`,text:`${bt(n.chain)} | ChainID: ${n.chainId}`};let r=String(e.securityContext?.blockHeight||``).trim();return r?{kind:`ready`,text:`block ${r}`}:t?{kind:`loading`}:{kind:`ready`,text:`block`}}function bt(e){switch(e){case`near`:return`NEAR`;case`evm`:return`EVM`;case`tempo`:return`Tempo`;case`unknown`:return`Unknown`;default:return xt(e)}}function xt(e){throw Error(`Unexpected confirmation presentation: ${String(e)}`)}const St=`seams-surface-resize-begin`;function Ct(e,t){return e.dispatchEvent(new CustomEvent(St,{bubbles:!0,composed:!0,detail:t}))}function wt(e,t,n){let r=t;return e.addEventListener(St,r,n),()=>e.removeEventListener(St,r,n)}const Tt=`data-seams-confirm-surface`,R=`seams-confirm-surface-pinned`,z=`seams-confirm-surface-pinned-root`,B=`seams-surface-height-driven`,Et=`--seams-surface-height-driven-target`;function Dt(e,t){let{fromCssPx:n,toCssPx:r}=t;if(!Number.isFinite(n)||!Number.isFinite(r))return!1;let i=r-n;if(Math.abs(i)<1)return!1;let a=Math.min(n,r),o=Math.max(n,r),s=null,c=!1,l=null,u=e=>{if(c)return;let r=n+(Number.isFinite(e)?Math.min(Math.max(e,0),1):0)*i;t.setHeightCssPx(Math.min(Math.max(r,a),o))},d=()=>{c||(c=!0,l!==null&&window.clearTimeout(l),t.finish())},f=()=>s||c?null:(t.onClaimed?.(),u(0),l=window.setTimeout(()=>{u(1),d()},1500),s={setProgress:u,finish:d},s);return Ct(e,{...t.reason?{reason:t.reason}:{},deltaCssPx:i,claim:f}),s!==null}function Ot(e){let t=null,n=null,r=()=>{let e=n;n=null,e&&e.classList.remove(B)};return{capture(){let n=e.element();t=n?n.getBoundingClientRect().height:null},commit(){let i=t;t=null;let a=e.element();!a||i===null||document.documentElement.classList.contains(z)||a.parentElement?.closest(`.${B}`)||(n=a,a.classList.add(B),e.setHeightCssPx(i),Promise.resolve(e.settled?.()).then(()=>new Promise(e=>requestAnimationFrame(()=>e()))).then(()=>{if(n!==a)return;if(document.documentElement.classList.contains(z)){r();return}a.classList.remove(B);let t=a.getBoundingClientRect().height;a.classList.add(B),V({...e.reason?{reason:e.reason}:{},element:a,fromCssPx:i,toCssPx:t,setHeightCssPx:t=>e.setHeightCssPx(t),onSettled:()=>{n=null}})||r()}))},dispose:r}}function V(e){let{element:t,fromCssPx:n,toCssPx:r}=e;if(!Number.isFinite(n)||!Number.isFinite(r)||Math.abs(r-n)<1)return!1;let i=e.drivenClasses??[B],a=i.filter(e=>!t.classList.contains(e));t.classList.add(...a),e.setHeightCssPx(n);let o=Dt(t,{...e.reason?{reason:e.reason}:{},fromCssPx:n,toCssPx:r,setHeightCssPx:e.setHeightCssPx,finish:()=>{t.classList.remove(...i),e.onSettled?.()}});return o||t.classList.remove(...a),o}let kt=null;const At={blipFrames:0,trace(e=2e3){return new Promise(t=>{let n=[],r=performance.now(),i=()=>{let a=kt,o=a?.classList.contains(R)?`*`:``;n.push(`${Math.round(performance.now()-r)}: box=${document.documentElement.clientHeight} content=${a?Math.round(a.getBoundingClientRect().height):`-`}${o}`),performance.now()-r<e?requestAnimationFrame(i):t(n)};requestAnimationFrame(i)})}};function jt(e){kt=e;try{window.__seamsSurfaceMotion=At}catch{}}function Mt(){let e=document.documentElement?.clientHeight??0;return e>0?e:window.innerHeight}function Nt(e,t,n){return Math.min(Math.max(e,t),n)}function Pt(e){return e.getAttribute(Tt)===`wallet-iframe`}function Ft(e){if(typeof CSSStyleSheet!=`function`||!(`adoptedStyleSheets`in document))return null;let t=null,n=()=>{e.classList.remove(R),document.documentElement.classList.remove(z)};return{set(n){try{t||=new CSSStyleSheet,t.replaceSync(`.${R}{height:${Math.max(0,Math.round(n))}px}.${z}{overflow:hidden}`),document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t])}catch{return!1}return e.classList.add(R),document.documentElement.classList.add(z),!0},release:n,dispose(){if(n(),!t)return;let e=t;t=null;try{document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==e)}catch{}}}}function It(e,t={}){let n=t.viewportHeightCssPx??Mt,r=Ft(e);jt(e);let i=null,a=()=>{let e=i;e&&(i=null,e.frame!==null&&cancelAnimationFrame(e.frame),e.driver.setProgress(1),e.driver.finish(),r?.release())},o=()=>{let e=i;if(!e)return;e.frame=null;let t=n();t===e.lastViewportPx?e.framesSinceChange+=1:(e.lastViewportPx=t,e.framesSinceChange=0,e.moved=!0);let r=Nt((t-e.originHostPx)/e.deltaCssPx,0,1);if(r>=1){if(e.framesAtTarget+=1,e.sawIntermediate||e.framesAtTarget>=3){a();return}e.frame=requestAnimationFrame(o);return}e.framesAtTarget>0&&(At.blipFrames+=1),e.framesAtTarget=0,r>0&&(e.sawIntermediate=!0),e.driver.setProgress(r);let s=e.moved?8:20;if(e.framesSinceChange>=s){a();return}e.frame=requestAnimationFrame(o)},s=wt(e,t=>{let s=t.detail;if(!r||!s||!Pt(e))return;let c=s.deltaCssPx;if(!Number.isFinite(c)||Math.abs(c)<1)return;a();let l=n(),u=e.getBoundingClientRect().height;if(!(l>0)||!(u>0)||Math.abs(l-u)>1)return;let d=Math.round(u),f=d+c;if(!(f>0)||!r.set(f))return;let p=s.claim();if(!p){r.release();return}i={driver:p,originHostPx:d,deltaCssPx:c,lastViewportPx:l,framesSinceChange:0,moved:!1,sawIntermediate:!1,framesAtTarget:0,frame:null},i.frame=requestAnimationFrame(o)});return{dispose(){s(),a(),r?.dispose()}}}function H(e){let t=e.size??`100%`,n=e.strokeWidth??2;return D(`svg`,{class:`padlock-icon seams-padlock-icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":n,"stroke-linecap":`round`,"stroke-linejoin":`round`,width:t,height:t,"aria-hidden":`true`,focusable:`false`,children:[D(`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}),D(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]})}let Lt=0;var Rt=class extends T{id=`seams-halo-${++Lt}`;element=A();motion=null;frame=null;startedAt=null;angle=null;componentDidMount(){this.motion=this.element.current.ownerDocument.defaultView.matchMedia(`(prefers-reduced-motion: no-preference)`),this.motion.addEventListener(`change`,this.updateAnimation),this.syncDynamicStyles(),this.updateAnimation()}componentDidUpdate(e){e.styles!==this.props.styles&&e.styles.deleteDynamicRule(this.id),e.innerPadding!==this.props.innerPadding&&this.syncDynamicStyles(),(e.animated!==this.props.animated||e.durationMs!==this.props.durationMs||e.styles!==this.props.styles)&&this.updateAnimation()}componentWillUnmount(){this.cancelFrame(),this.motion?.removeEventListener(`change`,this.updateAnimation),this.motion=null,this.props.styles.deleteDynamicRule(this.id)}cancelFrame(){let e=this.element.current?.ownerDocument.defaultView;this.frame!==null&&e?.cancelAnimationFrame(this.frame),this.frame=null,this.startedAt=null}updateAnimation=()=>{this.cancelFrame(),this.angle=null,this.syncDynamicStyles(),this.props.animated&&this.motion?.matches&&(this.frame=this.element.current.ownerDocument.defaultView.requestAnimationFrame(this.tick))};tick=e=>{if(!this.element.current||!this.props.animated||!this.motion?.matches)return;this.startedAt??=e;let t=this.props.durationMs,n=t&&Number.isFinite(t)&&t>0?t:1150;this.angle=`${(e-this.startedAt)%n/n*360}deg`,this.syncDynamicStyles(),this.frame=this.element.current.ownerDocument.defaultView.requestAnimationFrame(this.tick)};syncDynamicStyles(){let e={};if(this.props.innerPadding&&(e[`--inner-padding`]=this.props.innerPadding),this.angle&&(e[`--halo-angle`]=this.angle),Object.keys(e).length===0){this.props.styles.deleteDynamicRule(this.id);return}this.props.styles.setDynamicDeclarations(this.id,`#${this.id}`,e)}render(){return D(`div`,{id:this.id,ref:this.element,class:`seams-halo-border`,children:D(`div`,{class:`halo-root${this.props.animated?` animated`:``}`,children:D(`div`,{class:`halo-inner`,children:D(`div`,{class:`halo-outer`,children:[this.props.animated&&D(`div`,{class:`halo-ring`,"aria-hidden":`true`}),D(`div`,{class:`halo-content`,children:this.props.children})]})})})})}};function zt(e){return D(`div`,{class:`seams-passkey-halo-loading`,"aria-hidden":`true`,children:D(`div`,{class:`seams-passkey-loading-root`,children:D(Rt,{animated:e.animated,innerPadding:e.innerPadding,styles:e.styles,children:D(`div`,{class:`seams-passkey-loading-touch-icon-container`,children:D(`svg`,{class:`seams-passkey-loading-touch-icon`,"data-icon":e.icon,width:e.size??36,height:e.size??36,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,focusable:`false`,children:e.icon===`mail`?D(Bt,{}):D(Vt,{})})})})})})}function Bt(){return D(E,{children:[D(`path`,{d:`M4.5 6.5H19.5C20.0523 6.5 20.5 6.94772 20.5 7.5V16.5C20.5 17.0523 20.0523 17.5 19.5 17.5H4.5C3.94772 17.5 3.5 17.0523 3.5 16.5V7.5C3.5 6.94772 3.94772 6.5 4.5 6.5Z`,stroke:`currentColor`,"stroke-width":`var(--seams-modal__passkey-halo-loading-touch-icon__stroke-width, 3)`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`}),D(`path`,{d:`M4.25 7.25L12 12.75L19.75 7.25`,stroke:`currentColor`,"stroke-width":`var(--seams-modal__passkey-halo-loading-touch-icon__stroke-width, 3)`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`})]})}function Vt(){return D(`path`,{d:`M6.40519 19.0481C6.58912 18.6051 6.75832 18.1545 6.91219 17.6969M14.3433 20.6926C14.6095 19.9418 14.8456 19.1768 15.0502 18.399C15.2359 17.6934 15.3956 16.9772 15.5283 16.2516M19.4477 17.0583C19.8121 15.0944 20.0026 13.0694 20.0026 11C20.0026 6.58172 16.4209 3 12.0026 3C10.7472 3 9.55932 3.28918 8.50195 3.80456M3.52344 15.0245C3.83663 13.7343 4.00262 12.3865 4.00262 11C4.00262 9.25969 4.55832 7.64917 5.50195 6.33621M12.003 11C12.003 13.7604 11.5557 16.4163 10.7295 18.8992C10.5169 19.5381 10.2792 20.1655 10.0176 20.7803M7.71227 14.5C7.90323 13.3618 8.00262 12.1925 8.00262 11C8.00262 8.79086 9.79348 7 12.0026 7C14.2118 7 16.0026 8.79086 16.0026 11C16.0026 11.6166 15.9834 12.2287 15.9455 12.8357`,stroke:`currentColor`,"stroke-width":`var(--seams-modal__passkey-halo-loading-touch-icon__stroke-width, 3)`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`,pathLength:`1`})}function Ht(e){return D(E,{children:[D(`span`,{class:`loading-ellipsis`,"aria-hidden":`true`,children:[D(`span`,{class:`loading-ellipsis__dot`,children:`.`}),D(`span`,{class:`loading-ellipsis__dot`,children:`.`}),D(`span`,{class:`loading-ellipsis__dot`,children:`.`})]}),D(`span`,{class:`sr-only`,children:D(k,{copy:e.label})})]})}function Ut(e,t){return`${e.trim().replace(/\/$/,``)}/address/${encodeURIComponent(t)}`}function U(e){return D(`a`,{class:`highlight-receiver-id`,href:Ut(e.base,e.address),target:`_blank`,rel:`noopener noreferrer`,children:e.children})}function W(e){let t=e.trim();return/^0x[0-9a-fA-F]{40}$/.test(t)?`${t.slice(0,8)}...${t.slice(-4)}`:t}function Wt(e){let t=e.label.trim().match(/^(Transaction(?:\s+\d+)?\s+to contract)\b/i);return t?`${t[1]} `:void 0}function Gt(e){throw Error(`Unsupported transaction action: ${String(e)}`)}function Kt(e){let t=e.action;if(t)switch(t.type){case h.FunctionCall:return`Calling ${t.methodName} with ${P(t.deposit)} using ${Ue(t.gas)}`;case h.Transfer:return`Transfer ${P(t.amount)}`;case h.CreateAccount:return`Creating Account`;case h.DeleteAccount:return`Deleting Account`;case h.Stake:return`Staking ${P(t.stake)}`;case h.AddKey:return`Adding Key`;case h.DeleteKey:return`Deleting Key`;case h.DeployContract:return`Deploying WASM contract`;case h.DeployGlobalContract:return`Deploy global WASM contract (mode: ${t.deployMode}, size ${I(t.code)})`;case h.UseGlobalContract:return t.accountId?`Use global contract by account ${t.accountId}`:t.codeHash?`Use global contract by hash ${t.codeHash}`:`Use global contract`;default:return Gt(t)}if(e.transaction)return((e.totalTransactions??1)>1?`Transaction ${(e.transactionIndex??0)+1}: to `:`Transaction to `)+e.transaction.receiverId;let n=Wt(e);return e.contractAddress?.trim()&&n?n+W(e.contractAddress):e.label}function qt({node:e,explorers:t}){let n=e.action;if(n)switch(n.type){case h.FunctionCall:{let e=Ue(n.gas),t=P(n.deposit);return D(E,{children:[D(k,{message:`Calling`}),` `,D(`span`,{class:`highlight-method-name`,children:n.methodName}),t!==`0 NEAR`&&D(E,{children:[` `,D(k,{message:`with`}),` `,D(`span`,{class:`highlight-method-name`,children:t})]}),e&&D(E,{children:[` `,D(k,{message:`using`}),` `,D(`span`,{class:`highlight-method-name`,children:e})]})]})}case h.Transfer:return D(E,{children:[D(k,{message:`Transfer`}),` `,D(`span`,{class:`highlight-amount`,children:P(n.amount)})]});case h.CreateAccount:return D(k,{message:`Creating Account`});case h.DeleteAccount:return D(k,{message:`Deleting Account`});case h.Stake:return D(k,{message:`Staking {value0}`,values:{value0:P(n.stake)}});case h.AddKey:return D(k,{message:`Adding Key`});case h.DeleteKey:return D(k,{message:`Deleting Key`});case h.DeployContract:return D(k,{message:`Deploying WASM contract ({value0})`,values:{value0:I(n.code)}});case h.DeployGlobalContract:return D(k,{copy:Kt(e)});case h.UseGlobalContract:return n.accountId?D(E,{children:[D(k,{message:`Use global contract`}),` `,D(U,{base:t.near,address:n.accountId,children:n.accountId})]}):n.codeHash?D(E,{children:[D(k,{message:`Use global contract by hash`}),` `,D(`span`,{class:`highlight-method-name`,children:F(n.codeHash,{prefix:10,suffix:6})})]}):D(k,{message:`Use global contract`});default:return Gt(n)}if(e.transaction)return D(E,{children:[D(k,{copy:(e.totalTransactions??1)>1?`Transaction ${(e.transactionIndex??0)+1}: to `:`Transaction to `}),D(U,{base:t.near,address:e.transaction.receiverId,children:e.transaction.receiverId})]});let r=Wt(e),i=e.contractAddress?.trim();if(i&&r){let n=e.chain&&e.chain!==`unknown`?t[e.chain]:void 0;return D(E,{children:[D(k,{copy:r}),n?D(U,{base:n,address:i,children:W(i)}):D(`span`,{class:`highlight-receiver-id`,children:W(i)})]})}let a=e.label.trim();if(a.toLowerCase().startsWith(`calling `)){let e=a.slice(8).trim(),t=e.toLowerCase().indexOf(` using `);if(t<0&&e)return D(E,{children:[D(k,{message:`Calling`}),` `,D(`span`,{class:`highlight-method-name`,children:e})]});let n=e.slice(0,t).trim(),r=e.slice(t+7).trim();if(t>=0&&n)return D(E,{children:[D(k,{message:`Calling`}),` `,D(`span`,{class:`highlight-method-name`,children:n}),r&&D(E,{children:[D(k,{message:`using`}),` `,r]})]})}return e.fieldLabel?D(E,{children:[D(k,{copy:e.fieldLabel}),e.label.slice(e.fieldLabel.length)]}):D(k,{copy:e.label})}const G=[`anim-h`,`anim-h-active`,`anim-h-driven`],Jt=[...G,`anim-h-hold`];let Yt=0;function Xt(){return D(`svg`,{class:`chevron`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:D(`path`,{fill:`currentColor`,d:`M6 3l5 5-5 5z`})})}function Zt(e){return!!e.contentVariants?.decoded&&!!e.contentVariants.raw&&e.contentVariants.decoded!==e.contentVariants.raw}function Qt(e,t,n){return D(en,{node:n,depth:t,styles:e.styles,explorers:e.explorers,onToggle:e.onToggle,onCopy:e.onCopy},n.id)}function $t(e){if(!e.node.children?.length)return null;let t=D(`div`,{class:`tooltip-tree-root`,children:D(`div`,{class:`tooltip-tree-children`,children:e.node.children.map(Qt.bind(null,e,1))})});return D(`div`,{class:`seams-tx-tree`,"data-theme":e.theme,children:e.showShadow?D(`div`,{class:`tooltip-border-outer`,children:t}):t})}var en=class extends T{static contextType=C;state={mode:this.props.node.contentVariants?.defaultMode===`raw`?`raw`:`decoded`,copied:!1};id=`seams-tree-node-${++Yt}`;details=A();shell=A();disposed=!1;copiedTimer=null;frame=null;motionTimer=null;motion=null;modeHeight=null;componentDidUpdate(e){if(e.styles!==this.props.styles&&e.styles.deleteDynamicRule(this.id),this.modeHeight!==null&&this.shell.current){let e=this.shell.current,t=this.modeHeight;this.modeHeight=null,e.classList.remove(...G);let n=e.getBoundingClientRect().height;e.classList.add(...G),V({reason:`${this.props.node.id}:file-content-mode`,element:e,drivenClasses:G,fromCssPx:t,toCssPx:n,setHeightCssPx:this.setHeight,onSettled:this.releaseHeight})||(e.classList.remove(...G),this.releaseHeight())}}componentWillUnmount(){this.disposed=!0,this.copiedTimer!==null&&clearTimeout(this.copiedTimer),this.motionTimer!==null&&clearTimeout(this.motionTimer),this.frame!==null&&this.details.current?.ownerDocument.defaultView?.cancelAnimationFrame(this.frame),this.motion?.body.removeEventListener(`transitionend`,this.onTransitionEnd),this.motion=null,this.releaseHeight()}setHeight=e=>{this.disposed||this.props.styles.setDynamicDeclarations(this.id,`#${this.id}`,{"--seams-tree__anim-target":`${e}px`})};releaseHeight=()=>{this.props.styles.deleteDynamicRule(this.id)};clearCopied=()=>{this.copiedTimer=null,this.disposed||this.setState({copied:!1})};copy=async e=>{e.preventDefault(),e.stopPropagation();let t=this.props.node.copyValue;if(!t)return;let n=e.currentTarget.closest(`.seams-tx-tree`);if(n)try{if(!await le(n,t)||this.disposed)return;this.copiedTimer!==null&&clearTimeout(this.copiedTimer),this.setState({copied:!0}),this.copiedTimer=setTimeout(this.clearCopied,2e3),this.props.onCopy?.(t)}catch{}};toggleMode=e=>{e.preventDefault(),e.stopPropagation(),Zt(this.props.node)&&(this.shell.current&&(this.modeHeight=this.shell.current.getBoundingClientRect().height,this.setHeight(this.modeHeight),this.shell.current.classList.add(...G)),this.setState({mode:this.state.mode===`decoded`?`raw`:`decoded`}))};toggle=e=>{if(e.target.closest(`a, button`)){e.stopPropagation();return}e.preventDefault(),e.stopPropagation();let t=this.details.current;if(!t||this.motion)return;let n=t.querySelector(`:scope > .folder-children`),r=!t.open,i=t.ownerDocument.defaultView.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!n||i){t.open=r,this.props.onToggle?.(this.props.node.id,r);return}this.motion={body:n,open:r};let a=r?0:n.getBoundingClientRect().height;this.setHeight(a),n.classList.add(`anim-h`,`anim-h-active`,`anim-h-hold`),t.open=!0,n.offsetHeight,this.frame=t.ownerDocument.defaultView.requestAnimationFrame(this.startMotion)};startMotion=()=>{if(this.frame=null,!this.motion||this.disposed)return;let{body:e,open:t}=this.motion,n=e.getBoundingClientRect().height,r=t?e.scrollHeight:0;V({reason:this.props.node.id,element:e,drivenClasses:G,fromCssPx:n,toCssPx:r,setHeightCssPx:this.setHeight,onSettled:this.finishMotion})||(e.addEventListener(`transitionend`,this.onTransitionEnd),e.classList.remove(`anim-h-hold`),this.setHeight(r),this.motionTimer=setTimeout(this.finishMotion,t?200:250))};onTransitionEnd=e=>{e.target===this.motion?.body&&e.propertyName===`height`&&this.finishMotion()};finishMotion=()=>{if(this.disposed||!this.motion)return;let{body:e,open:t}=this.motion;this.motion=null,this.motionTimer!==null&&clearTimeout(this.motionTimer),this.motionTimer=null,e.removeEventListener(`transitionend`,this.onTransitionEnd),e.classList.remove(...Jt),this.details.current&&(this.details.current.open=t),this.releaseHeight(),this.props.onToggle?.(this.props.node.id,t)};label(e){let t=this.props.node;return D(`span`,{class:`label${t.type===`file`?` label-action-node`:``}`,hidden:t.hideLabel,children:[e&&!t.hideChevron&&D(Xt,{}),D(`span`,{class:`label-text`,title:M(this.context,Kt(t)),children:D(qt,{node:t,explorers:this.props.explorers})}),t.type===`file`&&t.copyValue&&D(`button`,{type:`button`,class:`copy-badge`,"data-copied":String(this.state.copied),onClick:this.copy,title:M(this.context,this.state.copied?`Copied`:`Copy`),children:this.state.copied?`copied`:`copy`})]})}render(){let{node:e,depth:t}=this.props,n=`row summary-row depth-${Math.max(0,t-1)}`;if(e.type===`file`&&!e.content)return D(`div`,{id:this.id,class:`row file-row depth-${Math.max(0,t-1)}`,"data-no-elbow":String(!!e.hideLabel),children:[D(`span`,{class:`indent`}),this.label(!1)]});let r=Zt(e),i=r&&e.contentVariants?e.contentVariants[this.state.mode]:e.content,a=this.state.mode===`decoded`?`bytes`:`decoded`;return D(`details`,{id:this.id,ref:this.details,class:`tree-node ${e.type}`,open:!!e.open,"data-node-id":e.id,children:[D(`summary`,{class:n,"data-no-elbow":String(!!e.hideLabel),onClick:this.toggle,children:[D(`span`,{class:`indent`}),this.label(!0),e.type===`file`&&D(`div`,{ref:this.shell,class:`file-content-shell${r?` has-mode-toggle`:``}`,children:[r&&D(`button`,{type:`button`,class:`file-content-mode-toggle`,title:M(this.context,`Show ${a}`),"aria-label":M(this.context,`Show ${a}`),onClick:this.toggleMode,children:D(k,{copy:a})}),D(`div`,{class:`file-content`,children:i})]})]}),e.type===`folder`&&!!e.children?.length&&D(`div`,{class:`folder-children`,children:e.children.map(Qt.bind(null,this.props,t+1))})]})}};let tn=0;function nn(e){e.stopPropagation()}var rn=class extends T{static contextType=C;state={armed:!1};id=`seams-confirm-content-${++tn}`;root=A();reflow;frame=null;capturedBeforeUpdate=!1;reflowEnabled=!0;constructor(e){super(e),this.reflow=Ot({reason:`tx-body`,element:this.getReflowElement,setHeightCssPx:this.setHeight})}getReflowElement=()=>{let e=this.root.current;return e?.closest(`.modal-container-root, .seams-confirmation-drawer`)??e};setHeight=e=>{let t=this.getReflowElement(),n=t?.id?`#${t.id}`:`#${this.id}`;this.props.styles.setDynamicDeclarations(this.id,n,{[Et]:`${e}px`})};componentDidMount(){this.reflowEnabled=this.getReflowElement()===this.root.current,this.frame=this.root.current.ownerDocument.defaultView.requestAnimationFrame(this.afterFirstPaint)}afterFirstPaint=()=>{this.frame=this.root.current.ownerDocument.defaultView.requestAnimationFrame(this.arm)};arm=()=>{this.frame=null,this.setState({armed:!0})};componentWillReceiveProps(){this.reflowEnabled&&(this.reflow.capture(),this.capturedBeforeUpdate=!0)}componentWillUpdate(){this.reflowEnabled&&(this.capturedBeforeUpdate||this.reflow.capture())}componentDidUpdate(e){this.reflowEnabled&&(this.capturedBeforeUpdate=!1,e.styles!==this.props.styles&&e.styles.deleteDynamicRule(this.id),this.reflow.commit())}componentWillUnmount(){this.frame!==null&&this.root.current?.ownerDocument.defaultView?.cancelAnimationFrame(this.frame),this.frame=null,this.reflow.dispose(),this.props.styles.deleteDynamicRule(this.id)}confirm=()=>{this.state.armed&&this.props.decision.kind===`ready`&&this.props.decision.onConfirm()};cancel=()=>{this.props.onCancel()};render(){let e=this.props.decision.kind===`preparing`;return D(`div`,{class:`seams-tx-confirm-content`,onPointerDown:nn,onMouseDown:nn,onTouchStart:nn,children:D(`div`,{id:this.id,ref:this.root,class:`txc-root`,children:[this.props.errorMessage&&D(`div`,{class:`error`,role:`alert`,children:D(k,{copy:this.props.errorMessage})}),this.props.tree&&D(`div`,{class:`tooltip-width`,children:D($t,{node:this.props.tree,theme:this.props.theme,explorers:this.props.explorers,styles:this.props.styles,showShadow:!1,onToggle:this.props.onTreeToggle,onCopy:this.props.onCopy})}),D(`div`,{class:`actions`,children:[!this.props.cancelInHeader&&D(`button`,{type:`button`,class:`cancel`,onClick:this.cancel,children:D(k,{copy:this.props.cancelText})}),D(`button`,{type:this.props.decision.kind===`form`?`submit`:`button`,form:this.props.decision.kind===`form`?this.props.decision.formId:void 0,class:`confirm${e?` loading`:``}`,onClick:this.confirm,disabled:e||!this.state.armed,children:e?D(E,{children:[D(`span`,{class:`loading-indicator`,role:`progressbar`,"aria-label":w(this.context,`Loading`)}),D(`span`,{children:D(k,{message:`Loading...`})})]}):D(E,{children:[this.props.confirmIcon,D(k,{copy:this.props.confirmText})]})})]})]})})}};function an(e){throw Error(`Unexpected confirmation body: ${String(e)}`)}var on=class extends T{static contextType=C;copy=()=>{this.props.model.kind===`funding`&&this.props.onCopyAccount(this.props.model.accountId)};render(){let e=this.props.model;switch(e.kind){case`empty`:return null;case`text`:return D(`div`,{class:`confirmation-body`,children:D(k,{copy:e.text})});case`status`:return D(`div`,{class:`confirmation-body confirmation-body--status`,children:D(k,{copy:e.text})});case`funding`:return D(`div`,{class:`confirmation-body confirmation-body--funding`,children:[D(k,{message:`NEAR account`}),D(`button`,{type:`button`,class:`confirmation-body__copy-target`,title:M(this.context,`Copy ${e.accountId}`),"aria-label":M(this.context,`Copy NEAR account ${e.accountId}`),onClick:this.copy,children:e.shortAccountId}),D(k,{message:`needs funding`})]});default:return an(e)}}};function sn(e){let t=j();return D(`div`,{class:`passkey-registration-confirm__identity`,"aria-label":w(t,`Passkey registration details`),children:[D(`div`,{class:`passkey-registration-confirm__row`,children:[D(`span`,{class:`passkey-registration-confirm__label`,children:D(k,{message:`Account`})}),D(`span`,{class:`passkey-registration-confirm__value`,title:M(t,e.display.intendedUserName),children:e.display.intendedUserName})]}),D(`div`,{class:`passkey-registration-confirm__row`,children:[D(`span`,{class:`passkey-registration-confirm__label`,children:D(k,{message:`Website`})}),D(`span`,{class:`passkey-registration-confirm__value`,title:M(t,e.display.rpId),children:e.display.rpId})]})]})}var cn=class extends T{static contextType=C;confirm=()=>{this.props.decision.kind===`ready`&&this.props.decision.onConfirm()};cancel=()=>{this.props.onCancel()};render(){let e=this.props.decision.kind===`creating`;return D(`div`,{ref:this.props.root,class:`passkey-registration-confirm`,children:[D(`div`,{class:`hero passkey-registration-confirm__hero`,children:[D(zt,{animated:!this.props.errorMessage,icon:`fingerprint`,size:44,styles:this.props.styles}),D(`div`,{class:`hero-container passkey-registration-confirm__hero-copy`,children:[D(`h2`,{class:`hero-heading`,children:D(k,{copy:this.props.heading})}),D(`p`,{class:`passkey-registration-confirm__body`,children:D(k,{copy:this.props.body})})]})]}),this.props.errorMessage&&D(`div`,{class:`error-banner`,children:D(k,{copy:this.props.errorMessage})}),D(sn,{display:this.props.display}),D(`div`,{class:`passkey-registration-confirm__actions`,children:[D(`button`,{type:`button`,class:`btn btn-cancel`,onClick:this.cancel,children:D(k,{copy:this.props.cancelText})}),D(`button`,{type:`button`,class:`btn btn-confirm`,disabled:e,onClick:this.confirm,children:e?D(E,{children:[D(`span`,{class:`loading-indicator passkey-registration-confirm__spinner`,role:`progressbar`,"aria-label":w(this.context,`Creating passkey`)}),D(`span`,{class:`passkey-registration-confirm__busy-label`,children:D(k,{message:`Creating passkey...`})})]}):D(k,{message:`Create passkey`})})]})]})}};let ln=0;var un=class extends T{id=`seams-email-code-${++ln}`;input=e=>{this.props.state.kind===`editing`&&this.props.state.onInput(e.currentTarget.value)};resend=()=>{this.props.resend?.kind===`available`&&this.props.resend.onResend()};renderDigit=e=>{let t=this.props.code[e]||``;return D(`span`,{class:`email-otp-confirm__slot${t?` is-filled`:``}`,children:t},e)};render(){let e=this.props.state.kind!==`editing`,t=`${this.id}-helper`,n=`${this.id}-error`;return D(`div`,{class:`email-otp-confirm`,children:[D(`label`,{class:`email-otp-confirm__label`,for:this.id,children:D(k,{message:`Email code`})}),D(`div`,{class:`email-otp-confirm__code-field`,"data-disabled":e?`true`:`false`,children:[D(`input`,{id:this.id,name:`email-code`,type:`text`,class:`email-otp-confirm__input`,inputMode:`numeric`,autoComplete:`one-time-code`,"data-email-otp-challenge-id":this.props.challengeId,pattern:`[0-9]*`,maxLength:6,spellcheck:!1,value:this.props.code,disabled:e,onInput:this.input,"aria-invalid":this.props.errorMessage?`true`:void 0,"aria-describedby":this.props.errorMessage?`${t} ${n}`:t}),D(`div`,{class:`email-otp-confirm__slots${e?` is-submitting`:``}`,"aria-hidden":`true`,children:[0,1,2,3,4,5].map(this.renderDigit)})]}),D(`div`,{id:t,class:`email-otp-confirm__helper`,children:D(k,{copy:this.props.helperText})}),this.props.errorMessage&&D(`div`,{id:n,class:`email-otp-confirm__error`,children:D(k,{copy:this.props.errorMessage})}),this.props.resend&&D(`button`,{type:`button`,class:`email-otp-confirm__resend`,disabled:this.props.resend.kind===`unavailable`,onClick:this.resend,children:D(k,{copy:this.props.resend.label})})]})}},dn=class{codeState={kind:`editing`,code:``};resendState={kind:`available`,label:`Resend code`};error=``;countdown=null;options;constructor(e){this.options=e}input=e=>{if(this.codeState.kind!==`editing`)return;let t=e.replace(/\D/g,``).slice(0,6);this.error=``,this.codeState={kind:`editing`,code:t},t.length===6?this.confirm():this.publish()};confirm(){if(this.codeState.kind!==`editing`)return`ignored`;let e=this.codeState.code;return e.length===6?(this.error=``,this.codeState={kind:`fading`,code:e,timer:setTimeout(this.submit,150)},this.publish(),`accepted`):(this.error=`Enter the 6-digit Email OTP code.`,this.publish(),`invalid`)}submit=()=>{if(this.codeState.kind!==`fading`)return;let e=this.codeState.code;this.codeState={kind:`submitting`,code:e},this.publish(),this.isDisposed()||this.options.onSubmit(e)};retry(e){this.codeState.kind!==`disposed`&&(this.cancelFade(),this.codeState={kind:`editing`,code:this.codeState.code},this.error=e,this.publish())}setVerification(e){if(this.codeState.kind!==`disposed`)switch(e.kind){case`ready`:this.codeState.kind===`submitting`&&this.retry(``);return;case`pending`:this.cancelFade(),this.codeState={kind:`submitting`,code:this.codeState.code},this.publish();return;case`rejected`:this.retry(e.message);return}}resend=async()=>{if(this.codeState.kind!==`editing`||this.resendState.kind!==`available`)return;let e=this.options.resend;if(!e)return;let t=Date.now()+e.cooldownMs,n={kind:`sending`,until:t};if(this.resendState=n,this.error=``,this.publish(),this.isDisposed())return;let r;try{r=await e.send()}catch{r={kind:`failed`,message:`Could not send code.`}}if(this.isDisposed()||this.resendState!==n)return;let i=r.kind===`sent`?`Code sent`:`Resend code`;r.kind===`failed`&&(this.error=r.message),Date.now()>=t?this.resendState={kind:`available`,label:i}:(this.resendState={kind:`cooldown`,until:t,label:i},this.countdown=setInterval(this.tick,250)),this.publish()};tick=()=>{this.resendState.kind===`cooldown`&&(Date.now()>=this.resendState.until&&(this.resendState={kind:`available`,label:this.resendState.label},this.clearCountdown()),this.publish())};isDisposed(){return this.codeState.kind===`disposed`}publish(){this.codeState.kind!==`disposed`&&this.options.onChange({code:this.codeState.code,phase:this.codeState.kind,error:this.error,resend:this.options.resend?this.resendSnapshot():null})}resendSnapshot(){switch(this.resendState.kind){case`available`:return{available:this.codeState.kind===`editing`,label:this.resendState.label};case`sending`:return{available:!1,label:`Sending...`};case`cooldown`:return{available:!1,label:`Resend in ${Math.max(1,Math.ceil((this.resendState.until-Date.now())/1e3))}s`}}}cancelFade(){this.codeState.kind===`fading`&&clearTimeout(this.codeState.timer)}clearCountdown(){this.countdown!==null&&clearInterval(this.countdown),this.countdown=null}dispose(){this.cancelFade(),this.clearCountdown(),this.codeState={kind:`disposed`},this.error=``}};function fn(e){return D(pn,{...e},e.prompt.challengeId)}var pn=class extends T{static contextType=C;session;form=A();lifetime;constructor(e){super(e),this.lifetime={kind:`active`,challengeId:e.prompt.challengeId,emailHint:e.prompt.emailHint?.trim()||``},this.state={code:``,phase:`editing`,error:``,resend:e.prompt.onResend?{available:!0,label:`Resend code`}:null},this.session=new dn({onSubmit:this.submit,onChange:this.change,resend:e.prompt.onResend?{send:this.send,cooldownMs:Math.max(1e3,Math.floor(Number(e.prompt.resendDebounceMs)||1e4))}:null})}submit=e=>{this.lifetime.kind===`active`&&this.props.onSubmit(e,this.lifetime.challengeId)};send=async()=>{let e=this.props.prompt.onResend;if(!e)return{kind:`failed`,message:`Could not send code.`};try{let t=await e();if(this.lifetime.kind===`disposed`)return{kind:`sent`};let n=String(t?.challengeId||``).trim(),r=String(t?.emailHint||``).trim();return n&&(this.lifetime={kind:`active`,challengeId:n,emailHint:r||this.lifetime.emailHint}),{kind:`sent`}}catch(e){return{kind:`failed`,message:hn(e)}}};change=e=>{this.setState(e)};confirm=e=>{e.preventDefault(),e.stopPropagation(),this.session.confirm()===`invalid`&&this.setState({},this.focusCode)};focusCode=()=>{this.form.current?.querySelector(`input`)?.focus({preventScroll:!0})};componentDidMount(){this.session.setVerification(this.props.verification)}componentDidUpdate(e){mn(e.verification,this.props.verification)&&this.session.setVerification(this.props.verification)}componentWillUnmount(){this.lifetime={kind:`disposed`},this.session.dispose()}inputState(){switch(this.state.phase){case`editing`:return{kind:`editing`,onInput:this.session.input};case`fading`:return{kind:`fading`};case`submitting`:return{kind:`submitting`}}}resendAction(){let e=this.state.resend;return e?e.available?{kind:`available`,label:e.label,onResend:this.session.resend}:{kind:`unavailable`,label:e.label}:null}render(){return D(`form`,{ref:this.form,id:this.props.formId,onSubmit:this.confirm,noValidate:!0,children:D(un,{challengeId:this.lifetime.kind===`active`?this.lifetime.challengeId:``,code:this.state.code,helperText:this.props.prompt.helperText?.trim()||x(this.lifetime.kind===`active`?this.lifetime.emailHint:``),errorMessage:M(this.context,this.state.error||void 0),state:this.inputState(),resend:this.resendAction()})})}};function mn(e,t){return e.kind===t.kind?e.kind===`rejected`&&t.kind===`rejected`&&e.message!==t.message:!0}function hn(e){if(e&&typeof e==`object`&&`code`in e&&e.code===`rate_limited`){let t=`retryAfterMs`in e?Number(e.retryAfterMs):NaN;return Number.isFinite(t)&&t>0?`Too many requests. Try again in ${Math.max(1,Math.ceil(t/1e3))}s.`:`Too many requests. Try again shortly.`}return e instanceof Error&&e.message?e.message:`Could not send code.`}let gn=0;var _n=class extends T{root=A();id=`seams-review-disclosure-${++gn}`;componentDidMount(){this.root.current&&(this.root.current.open=this.props.initiallyOpen??!1)}motion=null;componentWillUnmount(){this.clearMotion(),this.root.current&&O(this.root.current.ownerDocument).deleteDynamicRule(this.id)}clearMotion(){this.motion&&(this.motion.kind===`local`&&(this.motion.size.onfinish=null,this.motion.size.cancel(),this.motion.fade.cancel()),this.motion=null,this.root.current?.removeAttribute(`data-resizing`))}setHeight=e=>{let t=this.root.current;t&&O(t.ownerDocument).setDynamicDeclarations(this.id,`#${this.id}`,{"--seams-review-disclosure-height":`${e}px`})};finish=()=>{this.root.current&&this.motion&&(this.root.current.open=this.motion.opening,this.root.current.removeAttribute(`data-closing`)),this.clearMotion()};toggle=e=>{let t=this.root.current;if(!t||(e.preventDefault(),this.motion?.kind===`hosted`))return;let n=this.motion?!this.motion.opening:!t.open,r=t.lastElementChild;if(!(r instanceof HTMLElement))return;let i=t.open?r.getBoundingClientRect().height:0;if(this.clearMotion(),t.toggleAttribute(`data-closing`,!n),window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||!t.animate){t.open=n,t.removeAttribute(`data-closing`);return}t.open=!0,t.setAttribute(`data-resizing`,``);let a=n?r.scrollHeight:0;if(this.motion={kind:`hosted`,opening:n},V({element:r,reason:`review-details`,fromCssPx:i,toCssPx:a,drivenClasses:[`seams-review-disclosure-driven`],setHeightCssPx:this.setHeight,onSettled:this.finish}))return;let o=r.animate([{height:`${i}px`,overflow:`hidden`},{height:`${a}px`,overflow:`hidden`}],{duration:n?220:180,easing:`cubic-bezier(.2,0,0,1)`,fill:`both`});this.motion={kind:`local`,opening:n,size:o,fade:r.animate(n?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],{duration:n?180:100,easing:`ease-out`,fill:`both`})},o.onfinish=this.finish};render(){return D(`details`,{ref:this.root,class:`seams-review-${this.props.kind??`technical`}`,children:[D(`summary`,{onClick:this.toggle,children:[D(k,{copy:this.props.label}),D(`svg`,{class:`seams-review-caret`,viewBox:`0 0 20 20`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.6`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:D(`path`,{d:`m5 7.5 5 5 5-5`})})]}),D(`div`,{id:this.id,children:this.props.children})]})}};function vn(){return D(`svg`,{class:`seams-receipt-wordmark`,viewBox:`0 0 1428 285`,role:`img`,"aria-label":`seams`,children:D(`path`,{d:`M 1152.240 22.260 C 1142.208 32.303, 1134 41.030, 1134 41.653 C 1134 42.276, 1134.625 43.026, 1135.388 43.319 C 1137.220 44.022, 1149.487 58.808, 1154.965 66.916 C 1160.947 75.770, 1167.188 88.708, 1170.922 100 C 1179.875 127.067, 1179.861 153.906, 1170.878 184.346 C 1169.767 188.111, 1169.068 191.402, 1169.325 191.658 C 1169.581 191.915, 1173.776 190.129, 1178.646 187.690 C 1189.458 182.274, 1206.826 175.821, 1220.384 172.183 L 1230.500 169.469 1231.685 161.485 C 1233.180 151.413, 1233.316 131.031, 1231.963 119.974 C 1231.393 115.313, 1229.818 106.851, 1228.463 101.170 C 1227.108 95.488, 1226 90.723, 1226 90.580 C 1226 90.437, 1231.063 91.354, 1237.250 92.617 C 1288.849 103.153, 1340.642 93.721, 1389.671 64.860 C 1397.021 60.533, 1419.577 45.437, 1422.276 43.038 C 1422.979 42.413, 1384.105 4.943, 1381.956 4.174 C 1381.455 3.995, 1378.447 5.832, 1375.273 8.256 C 1352.212 25.865, 1329.230 37.090, 1305.831 42.174 C 1290.920 45.414, 1262.231 45.389, 1247 42.123 C 1221.862 36.733, 1202.051 27.300, 1180.320 10.372 C 1175.820 6.867, 1171.766 4, 1171.309 4 C 1170.853 4, 1162.272 12.217, 1152.240 22.260 M 276 48.064 C 245.671 51.807, 220.471 65.845, 203.537 88.432 C 196.121 98.323, 188.492 116.648, 186.051 130.434 C 184.471 139.355, 184.755 159.897, 186.580 168.731 C 192.404 196.928, 208.854 220.370, 232.901 234.742 C 262.591 252.485, 304.246 254.795, 337.980 240.568 C 350.834 235.146, 367.194 223.594, 373.765 215.297 L 376.932 211.299 361.834 197.711 L 346.737 184.124 339.619 190.143 C 320.291 206.485, 299.180 212.864, 278.754 208.536 C 258.217 204.184, 242.399 188.671, 237.623 168.197 L 236.177 162 311.543 162 L 386.909 162 387.587 158.388 C 387.960 156.402, 388.018 148.189, 387.716 140.138 C 387.277 128.449, 386.625 123.586, 384.479 116 C 379.212 97.381, 371.713 84.617, 359.119 72.834 C 341.964 56.786, 321.656 48.842, 294.709 47.639 C 288.544 47.364, 280.125 47.556, 276 48.064 M 1000.983 49.026 C 981.627 51.294, 962.676 59.399, 951.124 70.351 C 938.360 82.454, 932.081 100.926, 935.370 116.700 C 938.138 129.975, 945.329 140.076, 958.015 148.510 C 967.604 154.885, 980.155 159.892, 1004.029 166.867 C 1015.288 170.156, 1026.528 173.719, 1029.008 174.784 C 1048.926 183.343, 1047.372 201.937, 1026.053 210.140 C 1015.474 214.211, 997.351 212.791, 986.004 207.002 C 979.694 203.783, 970.400 196.188, 965.527 190.269 C 962.915 187.096, 960.339 184.500, 959.804 184.500 C 959.268 184.500, 951.497 190.575, 942.534 198 C 929.678 208.651, 926.415 211.838, 927.076 213.103 C 928.792 216.389, 942.709 229.745, 948.500 233.663 C 980.766 255.495, 1031.930 258.256, 1064.810 239.938 C 1093.327 224.051, 1103.456 188.645, 1086.875 162.806 C 1079.079 150.656, 1060.449 139.092, 1036.756 131.697 C 1030.565 129.765, 1019.425 126.293, 1012 123.982 C 996.026 119.010, 990.228 116.248, 986.523 111.845 C 984.091 108.955, 983.837 107.979, 984.242 103.095 C 984.660 98.058, 985.089 97.243, 989.362 93.375 C 995.842 87.508, 1002.195 85.510, 1014 85.627 C 1029.536 85.780, 1040.165 90.408, 1053 102.609 L 1059.500 108.788 1074.500 95.232 C 1082.750 87.776, 1089.635 81.130, 1089.799 80.462 C 1090.225 78.739, 1079.812 69.686, 1071.224 64.313 C 1057.482 55.715, 1042.661 51.008, 1023.144 49.043 C 1011.825 47.903, 1010.580 47.902, 1000.983 49.026 M 478.921 50.482 C 460.570 53.573, 444.266 60.019, 429.500 70.020 C 421.367 75.529, 412.785 82.902, 413.207 84.017 C 413.368 84.442, 419.475 90.933, 426.777 98.443 L 440.055 112.097 448.277 105.504 C 457.467 98.135, 466.747 93.115, 477.373 89.764 C 483.388 87.867, 486.684 87.524, 498.500 87.561 C 514.277 87.612, 519.926 89.109, 528.209 95.433 C 533.564 99.522, 538.796 108.852, 539.546 115.650 C 539.840 118.318, 540.248 121.894, 540.453 123.597 L 540.825 126.694 512.662 127.312 C 474.264 128.156, 456.457 131.057, 438.650 139.369 C 409.872 152.803, 397.368 179.013, 406.084 207.632 C 408.813 216.591, 412.119 222.196, 418.848 229.266 C 433.800 244.978, 457.890 252.692, 484.002 250.132 C 504.167 248.154, 520.632 240.972, 534.077 228.288 L 541 221.758 541 233.379 L 541 245 566.559 245 L 592.118 245 591.717 179.750 C 591.282 109.141, 591.338 109.914, 585.549 94.533 C 576.527 70.565, 555.039 55.122, 524.252 50.482 C 512.527 48.714, 489.412 48.714, 478.921 50.482 M 72.366 51.570 C 50.831 55.188, 30.787 66.983, 21.508 81.500 C 9.386 100.466, 11.445 124.131, 26.601 140.021 C 37.041 150.966, 47.790 156.186, 80 165.955 C 101.571 172.497, 108.741 175.471, 113.227 179.737 C 122.014 188.093, 117.373 201.967, 103.727 208.137 C 99.071 210.242, 97.079 210.495, 85.500 210.457 C 74.475 210.420, 71.648 210.076, 66.895 208.189 C 57.333 204.394, 48.391 197.450, 39.713 187.077 L 36.013 182.655 31.756 186.047 C 22.049 193.784, 3 210.296, 3 210.975 C 3 212.867, 19.844 229.407, 25.799 233.361 C 42.118 244.199, 63.087 249.992, 86 249.992 C 132.157 249.992, 165.601 226.871, 167.716 193.500 C 168.732 177.462, 164.163 165.154, 153.024 153.923 C 141.991 142.799, 129.353 136.682, 96.500 126.567 C 76.762 120.489, 67.150 116.278, 64.064 112.355 C 60.911 108.346, 60.514 103.886, 62.843 98.621 C 65.477 92.667, 71.720 88.644, 81.804 86.400 C 88.654 84.876, 90.160 84.859, 98.418 86.211 C 110.806 88.240, 117.685 91.723, 127.138 100.754 L 134.931 108.199 137.816 105.850 C 146.860 98.484, 165.983 80.444, 165.693 79.550 C 164.936 77.217, 150.022 65.736, 142.959 62.051 C 122.849 51.558, 96.089 47.585, 72.366 51.570 M 825.539 51.051 C 817.528 52.301, 809.553 54.686, 804.028 57.486 C 796.847 61.125, 787.304 68.749, 783.769 73.673 L 780.532 78.180 779.078 75.840 C 775.424 69.955, 764.796 60.805, 757.750 57.477 C 746.137 51.993, 739.434 50.698, 725.533 51.254 C 706.839 52.001, 694.387 57.102, 681.866 69.140 L 676 74.781 676 65.390 L 676 56 651.661 56 L 627.322 56 626.663 83.750 C 626.300 99.013, 626.003 141.537, 626.002 178.250 L 626 245 650 245 L 674 245 674 187.958 C 674 125.947, 674.350 121.163, 679.650 110.703 C 691.004 88.298, 724.199 85.661, 735.947 106.231 C 741.820 116.514, 742 118.855, 742 184.966 L 742 245.037 765.250 244.768 L 788.500 244.500 789.039 184 C 789.453 137.683, 789.889 122.562, 790.903 119.500 C 794.665 108.131, 800.351 100.945, 809.283 96.269 C 813.828 93.890, 815.659 93.536, 823.500 93.519 C 831.355 93.502, 833.225 93.856, 838.201 96.300 C 845.065 99.670, 850.240 106.160, 853.351 115.297 C 855.395 121.302, 855.473 123.474, 855.781 183.250 L 856.099 245 880.095 245 L 904.091 245 903.766 176.750 C 903.447 109.712, 903.401 108.359, 901.212 100.558 C 894.210 75.604, 876.712 57.823, 854 52.581 C 845.325 50.579, 832.863 49.909, 825.539 51.051 M 279 83.691 C 264.019 86.199, 249.825 96.478, 243.191 109.624 C 240.856 114.250, 237 124.874, 237 126.682 C 237 126.857, 259.500 127, 287 127 C 317.941 127, 337 126.638, 337 126.049 C 337 122.644, 334.294 113.593, 331.779 108.589 C 325.881 96.853, 314.699 87.980, 301.458 84.531 C 296.022 83.115, 284.921 82.700, 279 83.691 M 1373.984 93.932 C 1358.717 101.014, 1349.722 104.330, 1336.008 107.930 L 1325.515 110.685 1324.277 117.592 C 1323.596 121.392, 1323.013 131.475, 1322.982 140 C 1322.924 156.322, 1324.865 170.597, 1328.959 183.948 C 1330.047 187.495, 1330.837 190.497, 1330.714 190.619 C 1330.592 190.742, 1326.893 189.972, 1322.496 188.909 C 1304.642 184.594, 1295.980 183.607, 1276 183.612 C 1260.205 183.616, 1254.056 184.048, 1243.635 185.884 C 1213.691 191.158, 1186.385 202.666, 1158.538 221.745 C 1146.555 229.956, 1134 239.793, 1134 240.971 C 1134 241.645, 1155.018 264.209, 1166.941 276.336 L 1171.695 281.172 1182.932 272.727 C 1209.090 253.066, 1232.355 242.974, 1260.846 238.927 C 1271.516 237.412, 1297.903 238.291, 1308 240.498 C 1333.016 245.966, 1352.163 255.502, 1374.794 273.765 L 1384.088 281.266 1386.294 279.318 C 1387.507 278.246, 1396.721 269.819, 1406.769 260.591 L 1425.039 243.812 1418.769 236.895 C 1393.960 209.525, 1382.368 185.212, 1378.937 153.347 C 1377.153 136.771, 1379.694 114.031, 1385.375 95.750 C 1386.699 91.487, 1387.494 88.028, 1387.141 88.063 C 1386.789 88.098, 1380.868 90.739, 1373.984 93.932 M 487 161.998 C 465.755 164.841, 454 174.462, 454 189.008 C 454 210.801, 485.917 220.760, 513.612 207.607 C 529.505 200.060, 540 183.837, 540 166.818 L 540 161 516.250 161.131 C 503.188 161.203, 490.025 161.593, 487 161.998`,stroke:`none`,fill:`currentColor`,"fill-rule":`evenodd`})})}function K({kind:e}){let t={back:`m15 6-6 6 6 6`,close:`M6 6l12 12M6 18L18 6`,minimize:`M5 12h14`,check:`m5 12 4 4L19 6`,arrow:`M7 17 17 7M7 7h10v10`,shield:`M12 3 4.5 6v5.5c0 4.2 2.7 7.4 7.5 9.5 4.8-2.1 7.5-5.3 7.5-9.5V6L12 3Z M8.5 11.5l2.5 2.5 4.5-5`,copy:`M8 8h12v12H8ZM4 16V4h12`,loader:`M12 3a9 9 0 1 1-9 9`,alert:`M12 8v5m0 3v.1M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0`,fingerprint:`M6.405 19.048c.184-.443.353-.894.507-1.351M14.343 20.693c.266-.751.502-1.516.707-2.294.186-.706.346-1.422.478-2.147M19.448 17.058c.364-1.964.555-3.989.555-6.058 0-4.418-3.582-8-8-8-1.255 0-2.443.289-3.501.805M3.523 15.025c.314-1.29.48-2.638.48-4.025 0-1.74.556-3.351 1.499-4.664M12.003 11c0 2.76-.447 5.416-1.273 7.899-.213.639-.451 1.266-.712 1.881M7.712 14.5c.191-1.138.291-2.308.291-3.5 0-2.209 1.791-4 4-4s4 1.791 4 4c0 .617-.02 1.229-.058 1.836`};return D(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.6`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:D(`path`,{d:t[e]})})}function yn(e){return e?e.chain===`evm`&&e.chainId===8453?`Base`:e.chain===`evm`&&e.chainId===84532?`Base Sepolia`:e.chain===`evm`&&e.chainId===1?`Ethereum`:e.chain===`evm`&&e.chainId===11155111?`Ethereum Sepolia`:`${e.chain.toUpperCase()}${e.chainId?` · ${e.chainId}`:``}`:`Wallet transaction`}function bn(e){if(e?.operations.length!==1)return null;let t=e.operations[0];return t.kind===`generic.contractCall`||t.kind===`tempo.eip2718`?t.to??null:null}function xn({value:e,class:t}){let n=j();return D(`bdi`,{class:`seams-review-middle ${t}`,dir:`ltr`,title:M(n,e),children:[D(`span`,{children:e.slice(0,-8)}),D(`span`,{children:e.slice(-8)})]})}function Sn({symbol:e}){return e===`ETH`?D(`svg`,{class:`seams-review-token`,viewBox:`0 0 42 42`,"aria-hidden":`true`,children:[D(`circle`,{cx:`21`,cy:`21`,r:`21`,fill:`#eef0fb`}),D(`path`,{d:`m21 6-9 15 9 5 9-5Z`,fill:`#627eea`}),D(`path`,{d:`m21 6 9 15-9 5Z`,fill:`#465da9`}),D(`path`,{d:`m12 23 9 13 9-13-9 5Z`,fill:`#627eea`})]}):e===`USDC`?D(`svg`,{class:`seams-review-token`,viewBox:`0 0 42 42`,"aria-hidden":`true`,children:[D(`circle`,{cx:`21`,cy:`21`,r:`21`,fill:`#2775ca`}),D(`path`,{d:`M17 8a14 14 0 0 0 0 26M25 8a14 14 0 0 1 0 26M26 15c-1-4-10-4-10 1 0 5 10 3 10 8 0 5-9 5-11 1M21 10v4m0 14v4`,fill:`none`,stroke:`white`,"stroke-width":`2`})]}):D(`span`,{class:`seams-review-token seams-review-token-fallback`,"aria-hidden":`true`,children:e.slice(0,1)})}function Cn({model:e,compact:t=!1}){let n=En(e);return n?D(`div`,{class:`seams-review-amount${t?` seams-review-amount--compact`:``}`,children:[!t&&D(Sn,{symbol:n.symbol}),D(`div`,{children:[D(`span`,{children:n.value}),` `,D(`small`,{children:n.symbol})]})]}):null}function wn(){return D(`div`,{class:`seams-receipt-footer`,children:[D(K,{kind:`shield`}),` `,D(`span`,{children:D(k,{message:`Secured by`})}),` `,D(vn,{})]})}function Tn(e,t){if(!/^\d+$/.test(e))return e;let n=e.padStart(t+1,`0`),r=n.slice(-t).replace(/0+$/,``);return`${n.slice(0,-t)}${r?`.${r}`:``}`}function En(e){let t=e?.totals;return t?.nativeValue?t.nativeSymbol===`yoctoNEAR`?{value:Tn(t.nativeValue,24),symbol:`NEAR`}:{value:t.nativeValue,symbol:t.nativeSymbol??``}:null}var q=class extends T{static contextType=C;state={copied:!1};lifetime=new AbortController;timer=null;resetCopied=()=>{this.setState({copied:!1})};componentWillUnmount(){this.lifetime.abort(),this.timer!==null&&clearTimeout(this.timer)}componentDidUpdate(e){e.value!==this.props.value&&(this.lifetime.abort(),this.lifetime=new AbortController,this.timer!==null&&clearTimeout(this.timer),this.resetCopied())}copy=async e=>{let t=e.currentTarget;if(!(t instanceof HTMLElement))return;let n=this.lifetime.signal;try{if(!await le(t,this.props.value,n)||n.aborted)return;this.setState({copied:!0}),this.timer!==null&&clearTimeout(this.timer),this.timer=setTimeout(this.resetCopied,3e3)}catch{n.aborted||this.setState({copied:!1})}};render(){return D(`button`,{type:`button`,class:`seams-review-copy${this.props.address?` seams-review-copy-address`:``}${this.state.copied?` copied`:``}`,onClick:this.copy,"aria-label":M(this.context,this.state.copied?`Copied`:this.props.label??`Copy value`),children:[this.props.address&&D(`bdi`,{class:`seams-review-full-address`,dir:`ltr`,children:this.props.value}),D(de,{})]})}};function Dn({node:e}){let t=j();if(e.action||e.transaction)return D(E,{children:D(k,{copy:Kt(e)})});let n=Wt(e);if(n&&e.contractAddress){let r=e.contractAddress;return D(`span`,{class:`seams-review-contract`,children:[D(k,{copy:n.trim()}),D(`span`,{class:`seams-review-contract-value`,children:[D(xn,{value:r,class:`seams-review-contract-address`}),D(q,{value:r,label:M(t,`Copy contract address ${r}`)})]})]})}if(e.fieldLabel){let t=e.label.slice(e.fieldLabel.length);return D(E,{children:[D(k,{copy:e.fieldLabel}),e.fieldLabel===`Method:`?D(`span`,{class:`seams-review-function`,children:t}):t]})}let r=/^(Call(?:ing)? )([^\s]+)(.*)$/.exec(e.label);return r?D(E,{children:[D(k,{copy:r[1]}),D(`span`,{class:`seams-review-function`,children:r[2]}),r[3]]}):D(E,{children:D(k,{copy:e.label})})}function On({node:e}){let t=j(),n=e.contentVariants?.decoded??e.content,r=!!(e.contentVariants||n?.includes(`
2
+ `));return D(`div`,{class:`seams-review-detail`,children:[D(`div`,{class:n?`seams-review-detail-row${r?` seams-review-detail-row--block`:``}`:`seams-review-detail-label`,children:[D(`span`,{children:D(Dn,{node:e})}),n&&D(`pre`,{children:n}),e.copyValue&&D(q,{value:e.copyValue})]}),e.contentVariants&&D(_n,{label:w(t,`Raw data`),kind:`raw`,children:D(`pre`,{children:e.contentVariants.raw})}),!!e.children?.length&&D(`div`,{class:`seams-review-detail-children`,children:e.children?.map(e=>D(On,{node:e},e.id))})]})}function kn({data:e,details:t=!0}){let n=j(),r=e.model,i=r?.operations[0],a=bn(r);return D(`div`,{class:`seams-transaction-review`,children:[D(Cn,{model:r}),r?.warnings?.map(e=>D(`div`,{class:`seams-review-warning`,role:`alert`,children:D(k,{copy:e.message})},e.code)),D(`dl`,{class:`seams-review-fields`,children:[a&&D(`div`,{children:[D(`dt`,{children:D(k,{message:`To`})}),D(`dd`,{class:`seams-review-recipient`,children:D(q,{value:a,address:!0,label:M(n,`Copy recipient address ${a}`)})})]}),r&&D(`div`,{children:[D(`dt`,{children:D(k,{message:`Network`})}),D(`dd`,{children:[D(`span`,{class:`seams-review-network-dot`}),yn(r)]})]}),r?.totals?.estimatedFee&&D(`div`,{children:[D(`dt`,{children:D(k,{message:`Estimated network fee`})}),D(`dd`,{children:[r.totals.estimatedFee,` `,r.totals.feeSymbol]})]})]}),t&&e.tree&&D(_n,{initiallyOpen:e.detailsInitiallyOpen,label:M(n,i?.kind===`near.message`?`Message details`:`Transaction details`),children:D(On,{node:e.tree})}),r?.signerAccount&&D(`div`,{class:`seams-review-account`,children:[D(`span`,{class:`seams-review-avatar`,"aria-hidden":`true`,children:`S`}),D(`div`,{children:[D(k,{message:`Signing account`}),D(`small`,{children:D(q,{value:r.signerAccount,address:!0,label:M(n,`Copy signing account address ${r.signerAccount}`)})})]})]})]})}let An=0;var jn=class extends T{static contextType=C;root=A();otpFormId=`seams-confirmation-email-${++An}`;reflowId=`seams-confirmation-content-surface-${An}`;getReflowElement=()=>this.root.current?.closest(`.modal-container-root, .seams-confirmation-drawer`)??null;setHeight=e=>{let t=this.getReflowElement();t?.id&&this.props.styles.setDynamicDeclarations(this.reflowId,`#${t.id}`,{[Et]:`${e}px`})};reflow=Ot({reason:`confirm-body`,element:this.getReflowElement,setHeightCssPx:this.setHeight});copyAccount=e=>{let t=this.root.current;t&&le(t,e).catch(Mn)};componentWillReceiveProps(){this.reflow.capture()}componentDidUpdate(e){e.styles!==this.props.styles&&e.styles.deleteDynamicRule(this.reflowId),this.reflow.commit()}componentWillUnmount(){this.reflow.dispose(),this.props.styles.deleteDynamicRule(this.reflowId)}render(){let e=this.props.model;switch(e.kind){case`registration`:return D(cn,{...e.registration,root:this.root,styles:this.props.styles});case`transaction`:return this.renderTransaction(e);default:return Nn(e)}}renderTransaction(e){let t=this.props.variant===`drawer`?`seams-confirmation-content seams-confirmation-content--drawer`:`seams-confirmation-content`,n=e.prompt.kind===`email`&&e.transaction.decision.kind===`ready`?{kind:`form`,formId:this.otpFormId}:e.transaction.decision;return D(`div`,{ref:this.root,class:t,children:D(`div`,{class:`seams-review-content`,children:[this.props.variant!==`drawer`&&D(`div`,{class:`seams-review-toolbar`,children:[D(`div`,{class:`seams-review-origin`,children:[e.transaction.onBack&&D(`button`,{type:`button`,"aria-label":w(this.context,`Back to review`),title:w(this.context,`Back to review`),disabled:n.kind===`preparing`,onClick:e.transaction.onBack,children:D(K,{kind:`back`})}),D(H,{}),e.header.website.kind===`ready`?e.header.website.text:D(Ht,{label:w(this.context,`Loading website`)})]}),D(`button`,{type:`button`,"aria-label":M(this.context,e.transaction.cancelText),onClick:e.transaction.onCancel,children:D(K,{kind:`close`})})]}),e.review.model&&D(`div`,{class:`seams-review-eyebrow`,children:e.review.model.operations.length===1?D(k,{copy:e.review.model.operations[0].label.replace(/\s+using\s+[\d,.]+\s+gas$/i,``)}):D(k,{message:`Transaction`})}),D(`h2`,{class:`seams-review-title`,children:D(k,{copy:e.header.heading})}),D(kn,{data:e.review}),D(`div`,{class:`seams-review-context`,children:[D(on,{model:e.body,onCopyAccount:this.copyAccount}),e.prompt.kind===`email`&&D(fn,{...e.prompt.email,formId:this.otpFormId})]}),D(rn,{...e.transaction,tree:null,styles:this.props.styles,decision:n,cancelInHeader:!0,confirmIcon:e.prompt.kind===`passkey`?D(K,{kind:`fingerprint`}):void 0}),D(wn,{})]})})}};function Mn(){}function Nn(e){throw Error(`Unexpected confirmation content: ${String(e)}`)}function J(e){return e.kind===`signing`||e.kind===`broadcasting`||e.kind===`submitted`}function Pn(e){switch(e.kind){case`signing`:return 0;case`signed`:case`broadcasting`:return 1;case`submitted`:case`reverted`:return 2;case`confirmed`:return 3;case`failed`:case`unknown`:return e.hash?2:0;default:return Ln(e)}}function Fn(e){switch(e.kind){case`signing`:return`Signing transaction`;case`signed`:return`Signature ready`;case`broadcasting`:return`Broadcasting transaction`;case`submitted`:return`Waiting for confirmation`;case`confirmed`:return`Transaction complete`;case`failed`:return`Transaction failed`;case`reverted`:return`Transaction reverted`;case`unknown`:return`Confirmation unavailable`;default:return Ln(e)}}function In(e){switch(e.kind){case`signing`:return`Preparing your signed transaction.`;case`signed`:return`Signature created, ready to broadcast.`;case`broadcasting`:return`Submitting your signed transaction to the network.`;case`submitted`:return`Submitted to the network. Waiting for the receipt.`;case`confirmed`:return`The network confirmed your transaction.`;case`failed`:case`reverted`:case`unknown`:return e.message;default:return Ln(e)}}function Ln(e){throw Error(`Unexpected transaction receipt state: ${String(e)}`)}const Rn=`cubic-bezier(0.22, 1, 0.36, 1)`;let zn=0;var Bn=class extends T{static contextType=C;explorerRow=A();explorerRowId=`seams-receipt-explorer-row-${++zn}`;minimize=()=>{this.props.receipt.onView(`toast`)};expand=()=>{this.props.receipt.onView(`expanded`)};close=()=>{J(this.props.receipt.state)?this.minimize():this.props.receipt.onDismiss()};componentDidUpdate(e){let{receipt:t}=this.props;t.view===`expanded`&&e.receipt.view===`expanded`&&t.state.kind===`confirmed`&&e.receipt.state.kind!==`confirmed`&&this.revealExplorerLink()}componentWillUnmount(){this.releaseExplorerRow()}setExplorerRowHeight=e=>{let t=this.explorerRow.current;t&&O(t.ownerDocument).setDynamicDeclarations(this.explorerRowId,`#${this.explorerRowId}`,{"--seams-receipt-explorer-height":`${e}px`})};releaseExplorerRow=()=>{let e=this.explorerRow.current;e&&(delete e.dataset.opening,O(e.ownerDocument).deleteDynamicRule(this.explorerRowId))};revealExplorerLink(){let e=this.explorerRow.current,t=e?.firstElementChild;if(!e||!t||e.ownerDocument.defaultView?.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let n=e.getBoundingClientRect().height;e.dataset.opening=``;let r=()=>{this.releaseExplorerRow(),t.animate([{opacity:0,filter:`blur(4px)`,transform:`translateY(6px)`},{opacity:1,filter:`blur(0)`,transform:`translateY(0)`}],{duration:240,easing:Rn})};if(!V({reason:`receipt-explorer`,element:e,fromCssPx:0,toCssPx:n,drivenClasses:[`seams-receipt-explorer-driven`],setHeightCssPx:this.setExplorerRowHeight,onSettled:r})){let t=e.animate([{height:`0px`},{height:`${n}px`}],{duration:240,easing:Rn});t.onfinish=r,t.oncancel=this.releaseExplorerRow}}render(){let{receipt:e,data:t}=this.props,n=Fn(e.state),r=e.state.kind===`confirmed`||e.state.kind===`signed`,i=J(e.state),a=Pn(e.state),o=bn(t.model),s=e.state.kind===`confirmed`&&e.state.hash?Vn(t.model,this.props.explorers,e.state.hash):null;return e.view===`toast`?D(`div`,{class:`seams-transaction-toast`,"data-completed-stages":a,"data-stage":e.state.kind,"data-pending":i,children:[D(`div`,{class:`seams-toast-progress`,"aria-hidden":`true`,children:D(`span`,{class:`seams-toast-progress-fill`,children:i&&D(`span`,{class:`seams-toast-progress-active`})})}),D(`span`,{class:`seams-receipt-symbol`,"data-pending":i,children:D(K,{kind:i?`loader`:r?`check`:`alert`})}),D(`div`,{class:`seams-transaction-toast-text`,children:[D(`strong`,{role:`status`,children:D(k,{copy:n})}),D(`span`,{children:yn(t.model)})]}),D(`button`,{type:`button`,class:`seams-receipt-open`,onClick:this.expand,children:[D(k,{message:`Open`}),` `,D(K,{kind:`arrow`})]}),!i&&D(`button`,{type:`button`,class:`seams-receipt-dismiss`,"aria-label":w(this.context,`Close transaction`),onClick:e.onDismiss,children:D(K,{kind:`close`})})]}):D(`div`,{class:`seams-transaction-receipt`,children:[D(`div`,{class:`seams-review-toolbar`,children:[D(`span`,{children:D(k,{message:`Transaction receipt`})}),D(`button`,{type:`button`,"aria-label":w(this.context,`Minimize transaction`),onClick:this.minimize,children:D(K,{kind:`minimize`})})]}),D(`div`,{class:`seams-receipt-heading`,children:[D(`span`,{class:`seams-receipt-symbol`,"data-pending":i,children:D(K,{kind:i?`loader`:r?`check`:`alert`})}),D(`div`,{children:[D(`h2`,{role:`status`,children:D(k,{copy:n})}),D(`p`,{children:D(k,{copy:In(e.state)})})]})]}),D(Cn,{model:t.model,compact:!0}),D(`div`,{class:`seams-receipt-destination`,children:[o&&D(E,{children:[D(k,{message:`To`}),` `,D(q,{value:o,address:!0,label:M(this.context,`Copy recipient address ${o}`)})]}),!o&&yn(t.model)]}),t.model?.totals?.estimatedFee&&D(`dl`,{class:`seams-review-fields`,children:D(`div`,{children:[D(`dt`,{children:D(k,{message:`Estimated network fee`})}),D(`dd`,{children:[t.model.totals.estimatedFee,` `,t.model.totals.feeSymbol]})]})}),D(`div`,{class:`seams-receipt-steps`,"aria-label":w(this.context,`Transaction progress`),children:[D(Un,{stage:`signing`,label:w(this.context,`Signed`),activeLabel:`Signing`,complete:a>=1,active:e.state.kind===`signing`}),D(Un,{stage:`broadcast`,label:w(this.context,`Broadcast`),activeLabel:`Broadcasting`,complete:a>=2,active:e.state.kind===`broadcasting`}),D(Un,{stage:`confirming`,label:M(this.context,e.state.kind===`reverted`?`Reverted`:`Confirmed`),activeLabel:`Confirming`,complete:a===3,active:e.state.kind===`submitted`})]}),D(_n,{label:w(this.context,`Receipt details`),children:D(`dl`,{class:`seams-review-fields`,children:[t.model?.signerAccount&&D(`div`,{children:[D(`dt`,{children:D(k,{message:`From`})}),D(`dd`,{class:`seams-review-recipient`,children:D(q,{value:t.model.signerAccount,address:!0,label:M(this.context,`Copy signer address ${t.model.signerAccount}`)})})]}),o&&D(`div`,{children:[D(`dt`,{children:[D(k,{message:`To`}),` `]}),D(`dd`,{class:`seams-review-recipient`,children:D(q,{value:o,address:!0,label:M(this.context,`Copy recipient address ${o}`)})})]}),e.state.hash&&D(`div`,{children:[D(`dt`,{children:D(k,{message:`Transaction`})}),D(`dd`,{children:[D(xn,{value:e.state.hash,class:`seams-review-hash`}),D(q,{value:e.state.hash})]})]}),D(`div`,{children:[D(`dt`,{children:D(k,{message:`Status`})}),D(`dd`,{children:D(k,{copy:n})})]})]})}),D(`button`,{type:`button`,class:`seams-receipt-primary`,onClick:this.close,children:J(e.state)?D(k,{message:`Continue in background`}):D(k,{message:`Done`})}),s&&D(`div`,{id:this.explorerRowId,class:`seams-receipt-explorer-row`,ref:this.explorerRow,children:D(`a`,{class:`seams-receipt-explorer`,href:s,target:`_blank`,rel:`noopener noreferrer`,children:[D(k,{message:`View transaction`}),` `,D(K,{kind:`arrow`})]})}),D(wn,{})]})}};function Vn(e,t,n){if(!e)return null;let r;switch(e.chain){case`near`:r=t.near;break;case`evm`:r=t.evm;break;case`tempo`:r=t.tempo;break;case`unknown`:return null;default:return Hn(e.chain)}if(!r)return null;let i=e.chain===`near`?`txns`:`tx`;return`${r.trim().replace(/\/$/,``)}/${i}/${encodeURIComponent(n)}`}function Hn(e){throw Error(`Unexpected display chain: ${String(e)}`)}function Un(e){let t=e.complete?`complete`:e.active?`active`:`waiting`;return D(`span`,{class:`seams-receipt-step`,"data-stage":e.stage,"data-state":t,"aria-current":e.active?`step`:void 0,children:[D(`span`,{class:`seams-receipt-track`,"aria-hidden":`true`}),D(k,{copy:e.active?e.activeLabel:e.label})]})}const Wn=`cubic-bezier(0.22, 1, 0.36, 1)`,Gn=[`.seams-receipt-symbol`,`[role="status"]`,`.seams-review-amount`];function Kn(e){let t=[];for(let n of Gn){let r=e.querySelector(n);r&&t.push({selector:n,text:r.textContent,bounds:r.getBoundingClientRect(),fontSize:getComputedStyle(r).fontSize})}return t}let qn=0;var Jn=class{element;styles;presentation;state;receipt=null;receiptMotion=[];receiptShell=null;clearReceiptMotion=()=>{for(let e of this.receiptMotion)e.cancel();this.receiptMotion=[],this.receiptShell?.remove(),this.receiptShell=null,this.element.removeAttribute(`data-receipt-morphing`)};constructor(e){let t=e.parent.ownerDocument;this.styles=O(t),this.presentation={variant:e.presentation.variant,context:e.presentation.context},this.state={kind:`mounted`,model:e.model,onClosed:e.onClosed},this.element=t.createElement(`div`),this.element.id=`seams-confirmation-surface-${++qn}`,this.element.className=`seams-wallet-ui seams-confirmation-surface`,this.element.dataset.seamsConfirmSurface=e.presentation.context,this.element.dataset.seamsConfirmVariant=e.presentation.variant,this.element.addEventListener(`cancel`,this.cancel),e.parent.appendChild(this.element);try{this.update(e.model)}catch(e){throw this.remove(),e}}update(e){this.state.kind===`mounted`&&(this.state.model=e,this.element.dataset.confirmationKind=e.content.kind,this.element.dataset.seamsConfirmReady=String(e.content.kind===`transaction`&&e.content.transaction.decision.kind===`ready`),this.element.lang=e.appearance.locale??`en`,this.element.dataset.theme=e.appearance.theme.mode,this.styles.setDynamicRule(this.element.id,ce(this.element.id,e.appearance)),this.renderSurface())}close(){this.state.kind===`mounted`&&(this.state={kind:`closing`,model:this.state.model,onClosed:this.state.onClosed},this.presentation.variant===`modal`?this.dispose():this.renderSurface())}showReceipt(e){if(this.state.kind!==`mounted`||this.state.model.content.kind!==`transaction`)return;let t=this.receipt?.view!==e.view,n=this.receiptShell??this.element.querySelector(`.modal-container-root`),r=n?.getBoundingClientRect(),i=t?Kn(this.element):[],a=n?getComputedStyle(n).borderRadius:`26px`;t&&this.clearReceiptMotion(),this.receipt=e,this.element.dataset.receiptView=e.view,this.element.dataset.seamsConfirmSurface=`wallet-iframe`,this.element.dataset.seamsConfirmVariant=`modal`,this.renderSurface();let o=this.element.querySelector(`.modal-container-root`);if(t&&r&&o&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){let t=o.getBoundingClientRect(),n=this.element.ownerDocument.createElement(`div`);n.className=`seams-receipt-morph-shell`,n.setAttribute(`aria-hidden`,`true`),this.element.appendChild(n),this.receiptShell=n,this.element.setAttribute(`data-receipt-morphing`,``);let s=n.animate([{left:`${r.left}px`,top:`${r.top}px`,width:`${r.width}px`,height:`${r.height}px`,borderRadius:a},{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,borderRadius:getComputedStyle(o).borderRadius}],{duration:360,easing:Wn,fill:`both`});this.receiptMotion=[s];let c=new Set;for(let e of i){let t=o.querySelector(e.selector);if(!t||t.textContent!==e.text)continue;let n=t.getBoundingClientRect();c.add(t);let r=parseFloat(e.fontSize)/parseFloat(getComputedStyle(t).fontSize);this.receiptMotion.push(t.animate([{transform:`translate(${e.bounds.left-n.left}px, ${e.bounds.top-n.top}px) scale(${r})`,transformOrigin:`top left`},{transform:`translate(0, 0) scale(1)`,transformOrigin:`top left`}],{duration:360,easing:Wn}))}let l=o.querySelectorAll(`.seams-transaction-receipt > :not(.seams-receipt-heading), .seams-receipt-heading > .seams-receipt-symbol, .seams-receipt-heading h2, .seams-receipt-heading p, .seams-transaction-toast > :not(.seams-transaction-toast-text, .seams-toast-progress), .seams-transaction-toast-text > *`),u=0;for(let t of l)c.has(t)||(this.receiptMotion.push(t.animate([{opacity:0,transform:`translateY(8px)`},{opacity:1,transform:`translateY(0)`}],{duration:120,delay:e.view===`toast`?240:180+Math.min(u,4)*15,fill:`backwards`,easing:`ease-out`})),u+=1);s.onfinish=this.clearReceiptMotion}}dispose=()=>{if(this.state.kind===`disposed`)return;let e=this.state.onClosed;this.remove(),e()};remove(){this.clearReceiptMotion(),this.state={kind:`disposed`},this.element.removeEventListener(`cancel`,this.cancel),se(null,this.element),this.styles.deleteDynamicRule(this.element.id),this.element.remove()}cancel=()=>{if(this.state.kind!==`mounted`)return;if(this.receipt){J(this.receipt.state)?this.receipt.onView(`toast`):this.receipt.onDismiss();return}let e=this.state.model.content;e.kind===`registration`?e.registration.onCancel():e.transaction.onCancel()};confirm=()=>{if(this.state.kind!==`mounted`)return;let e=this.state.model.content,t=e.kind===`registration`?e.registration.decision:e.transaction.decision;t.kind===`ready`&&t.onConfirm()};submitOtp=(e,t)=>{if(this.state.kind!==`mounted`)return;let n=this.state.model.content;n.kind===`transaction`&&n.prompt.kind===`email`&&n.prompt.email.onSubmit(e,t)};renderSurface(){let e=this.state;if(e.kind===`disposed`)return;let t=e.model.content,n=this.contentModel(t,e.kind===`closing`),r=this.receipt&&t.kind===`transaction`?D(Bn,{receipt:this.receipt,data:t.review,explorers:t.transaction.explorers}):D(jn,{model:n,styles:this.styles,variant:this.presentation.variant}),i=t.kind===`registration`?t.registration.heading:t.header.heading;if(this.receipt||this.presentation.variant===`modal`){se(oe(e.model.appearance.locale??`en`,D(ue,{context:this.receipt?`wallet-iframe`:this.presentation.context,label:i,onCancel:this.cancel,children:r})),this.element);return}let a=t.kind===`registration`?t.registration.decision:t.transaction.decision;se(oe(e.model.appearance.locale??`en`,D(fe,{context:this.presentation.context,label:i,origin:t.kind===`transaction`&&t.header.website.kind===`ready`?D(E,{children:[D(H,{}),t.header.website.text]}):void 0,errorMessage:t.kind===`registration`?t.registration.errorMessage:t.transaction.errorMessage,styles:this.styles,state:e.kind===`closing`?{kind:`closing`,onClosed:this.dispose}:{kind:`open`,interaction:a.kind===`ready`?`ready`:`busy`},onCancel:this.cancel,children:r})),this.element)}contentModel(e,t){switch(e.kind){case`registration`:return{kind:`registration`,registration:{...e.registration,decision:!t&&e.registration.decision.kind===`ready`?{kind:`ready`,onConfirm:this.confirm}:{kind:`creating`},onCancel:this.cancel}};case`transaction`:return{kind:`transaction`,header:e.header,body:e.body,review:e.review,prompt:e.prompt.kind===`email`?{kind:`email`,email:{prompt:e.prompt.email.prompt,verification:t?{kind:`pending`}:e.prompt.email.verification,onSubmit:this.submitOtp}}:e.prompt,transaction:{...e.transaction,decision:!t&&e.transaction.decision.kind===`ready`?{kind:`ready`,onConfirm:this.confirm}:{kind:`preparing`},onCancel:this.cancel}};default:return Yn(e)}}};function Yn(e){throw Error(`Unexpected confirmation content: ${String(e)}`)}function Xn(e){return new Jn(e)}var Zn=class{element;surface;callbacks;appearance;presentation;tree;currentModel;constructor(e){this.callbacks=e.callbacks,this.appearance=e.appearance,this.presentation=e.presentation,this.tree=e.tree,this.currentModel=this.normalize(),this.surface=Xn({parent:e.parent,presentation:{variant:e.variant,context:e.context},model:this.currentModel,onClosed:e.onClosed}),this.element=this.surface.element}update(e){this.presentation=Qn(this.presentation,e),e.appearance&&(this.appearance=e.appearance),Object.hasOwn(e,`model`)&&(this.tree=L({model:e.model})),this.currentModel=this.normalize(),this.surface.update(this.currentModel)}setTree(e){this.tree=e,this.currentModel=this.normalize(),this.surface.update(this.currentModel)}close(){this.surface.close()}showReceipt(e){this.surface.showReceipt(e)}dispose(){this.surface.dispose()}normalize(){let e=ht({presentation:this.presentation,appearance:this.appearance,tree:this.tree,callbacks:this.callbacks});if(!e.ok)throw Error(`Cannot render confirmation surface: ${e.error}`);return e.model}};function Qn(e,t){return{model:Object.hasOwn(t,`model`)?t.model:e.model,securityContext:Object.hasOwn(t,`securityContext`)?t.securityContext:e.securityContext,loading:Object.hasOwn(t,`loading`)?t.loading:e.loading,preparing:Object.hasOwn(t,`preparing`)?t.preparing:e.preparing,title:Object.hasOwn(t,`title`)?t.title:e.title,body:Object.hasOwn(t,`body`)?t.body:e.body,errorMessage:Object.hasOwn(t,`errorMessage`)?t.errorMessage:e.errorMessage,confirmText:Object.hasOwn(t,`confirmText`)?t.confirmText:e.confirmText,cancelText:Object.hasOwn(t,`cancelText`)?t.cancelText:e.cancelText,onBack:Object.hasOwn(t,`onBack`)?t.onBack:e.onBack,signingAuthMode:Object.hasOwn(t,`signingAuthMode`)?t.signingAuthMode:e.signingAuthMode,emailOtpPrompt:Object.hasOwn(t,`emailOtpPrompt`)?t.emailOtpPrompt:e.emailOtpPrompt,nearExplorerUrl:Object.hasOwn(t,`nearExplorerUrl`)?t.nearExplorerUrl:e.nearExplorerUrl,tempoExplorerUrl:Object.hasOwn(t,`tempoExplorerUrl`)?t.tempoExplorerUrl:e.tempoExplorerUrl,evmExplorerUrl:Object.hasOwn(t,`evmExplorerUrl`)?t.evmExplorerUrl:e.evmExplorerUrl}}function $n(e){return new Zn(e)}const Y=`seams-confirm-portal`;function er(e){return Math.max(0,Math.round(performance.now()-e))}const tr=new WeakMap,nr=new WeakMap,X=new WeakMap,Z=new WeakMap,rr=new WeakMap,Q=new WeakMap;function ir(e){try{if(!Ve()||typeof window>`u`||window.parent===window)return;window.parent?.postMessage({type:e},`*`)}catch{}}function ar(e){return e===`drawer`?`drawer`:`modal`}function or(e){return(e||[]).map(e=>({receiverId:e.receiverId,actions:(e.actions||[]).map(e=>m(e)?e:ee(e)).map(e=>p(e))}))}async function sr(e,t){if(!(!((t?.length||0)>0)||!e))try{return await g(or(t))===e?void 0:`INTENT_DIGEST_MISMATCH`}catch{return`UI_DIGEST_VALIDATION_FAILED`}}function cr(e){e.childElementCount>0?e.classList.add(`seams-portal--visible`):e.classList.remove(`seams-portal--visible`)}function lr(){let e=[];for(let t of document.querySelectorAll(`.seams-confirmation-surface`))t.parentElement?.closest(`.seams-confirmation-surface`)||e.push(t);return e}function ur(){for(let e of lr())rr.get(e)?.callbacks.cancel(),Z.get(e)?.dispose(),Q.delete(e),$(e),e.remove();let e=document.getElementById(Y);e&&cr(e)}function dr(){let e=document.getElementById(Y);if(!e){e=document.createElement(`div`),e.id=Y,e.classList.add(`seams-portal`);let t=document.body??document.documentElement;t&&t.appendChild(e)}return e}function fr(e){Z.delete(e),Q.delete(e),$(e),e.remove();let t=document.getElementById(Y);t&&cr(t)}function pr(){(document.getElementById(Y)?.childElementCount??0)>0||ir(`WALLET_UI_CLOSED`)}function mr(e,t){let n=t?.chain;if(n!==`near`&&n!==`tempo`&&n!==`evm`)return{};let i=r({chains:e.chains,family:n,chainId:t?.chainId});return i?n===`near`?{nearExplorerUrl:i}:n===`tempo`?{tempoExplorerUrl:i}:{evmExplorerUrl:i}:{}}function hr(e,t){t&&(e.update(t),Object.hasOwn(t,`model`)&&gr(e.element,e,t.model))}function gr(e,t,n){let r=(Q.get(e)??0)+1;Q.set(e,r),!(!n||!at(n))&&import(`./enrichDisplayModelWithAbi-D0o0IL7_.js`).then(i=>{if(Q.get(e)!==r||!e.isConnected||Z.get(e)!==t)return;let a=i.enrichDisplayModelWithAbi(n);Q.get(e)===r&&t.setTree(L({model:a}))}).catch(e=>{console.warn(`[ConfirmUI] failed to lazy-load ABI display enrichment`,e)})}function $(e){tr.get(e)?.disconnect(),tr.delete(e),nr.get(e)?.dispose(),nr.delete(e),X.delete(e)}function _r(e,t){switch(e.kind){case`disabled`:return null;case`wallet_iframe`:return te({kind:`request_surface`,element:t,requestId:e.requestId,postMeasurement:e.postMeasurement});default:{let t=e;throw Error(`Unhandled confirmation measurement binding: ${String(t)}`)}}}function vr(e,t,n){e.setAttribute(Tt,Ar(n,t)),e.setAttribute(`data-seams-confirm-variant`,t),e.toggleAttribute(`data-seams-review-frame`,!!a(n))}function yr(e,t,n){if(a(n)?.attach(e),vr(e,t,n),ne(X.get(e),n))return;$(e),X.set(e,n);let r=_r(n,e);r&&(tr.set(e,r),nr.set(e,It(e)))}function br(e,t){t.kind===`review_available`&&e.returnToReview()}function xr(e){let t={kind:`review_available`},n=[],r=[],i=new Set,a=e=>{t.kind=`decision_published`;let i=r.shift();if(i){i(e);return}n.push(e)},o=e=>{a({kind:`cancelled`,error:e??null});for(let t of i)t({...e?{error:e}:{}})};return{cancelListeners:i,onBack:e?br.bind(null,e,t):void 0,callbacks:{confirm:()=>{e&&!e.allowInteraction()||a({kind:`confirmed`,emailOtp:{kind:`absent`}})},cancel:()=>o(),submitEmail:(t,n)=>{if(e&&!e.allowInteraction())return;let r=t.trim(),i=n.trim();if(!r||!i){o(`Email OTP challenge is missing.`);return}a({kind:`confirmed`,emailOtp:{kind:`provided`,code:r,challengeId:i}})}},takeDecision:async()=>n.shift()||await new Promise(e=>{r.push(e)})}}function Sr(e,t,n){let r=!1;return{element:e.element,close:i=>{r||(r=!0,i||t.callbacks.cancel(),t.cancelListeners.clear(),!(i&&n.kind===`wallet_iframe`&&ae(n.requestId,e))&&($(e.element),e.close()))},update:t=>hr(e,t),onCancel:e=>(t.cancelListeners.add(e),()=>t.cancelListeners.delete(e)),takeDecision:()=>t.takeDecision()}}async function Cr({ctx:e,summary:t,txSigningRequests:n,model:r,securityContext:i,loading:a,theme:o,appearance:s,uiMode:c,signingAuthMode:l,emailOtpPrompt:u}){return kr({ctx:e,summary:t,txSigningRequests:n,model:r,securityContext:i,loading:a,theme:o,appearance:s,variant:ar(c),signingAuthMode:l,emailOtpPrompt:u})}function wr(e){let t=e.surface.handle,n=t.element;if(!n.isConnected)throw Error(`Cannot reuse a detached confirmation surface`);let r=Z.get(n);if(!r)throw Error(`Cannot reuse an unmanaged confirmation surface`);yr(n,e.variant,e.ctx.surfaceMeasurementBinding);let i=ie({getAppearance:e.ctx.getAppearance,requestedAppearance:e.appearance,requestedMode:e.theme}),a=mr(e.ctx,e.model);return r.update({model:e.model,securityContext:e.securityContext,loading:e.loading??!1,appearance:i,title:e.summary.title??``,body:e.summary.body??``,signingAuthMode:e.signingAuthMode,emailOtpPrompt:e.emailOtpPrompt,errorMessage:``,...a}),r.setTree(L({txSigningRequests:e.txSigningRequests,model:e.model})),gr(n,r,e.model),{handle:t,reused:!0}}function Tr(e){throw Error(`Unhandled confirmation surface: ${JSON.stringify(e)}`)}function Er(e){switch(e.surface.kind){case`mount_new`:return{handle:kr({ctx:e.ctx,summary:e.summary,txSigningRequests:e.txSigningRequests,model:e.model,securityContext:e.securityContext,loading:e.loading,theme:e.theme,appearance:e.appearance,variant:e.variant,signingAuthMode:e.signingAuthMode,emailOtpPrompt:e.emailOtpPrompt}),reused:!1};case`reuse_mounted`:return wr({...e,surface:e.surface});case`preparation_cancelled`:throw Error(`A cancelled preparation surface cannot be mounted`);default:return Tr(e.surface)}}async function Dr(e){return Er({ctx:e.ctx,summary:e.summary,txSigningRequests:e.txSigningRequests,model:e.model,securityContext:e.securityContext,loading:e.loading,theme:e.theme,appearance:e.appearance,variant:ar(e.uiMode),signingAuthMode:e.signingAuthMode,emailOtpPrompt:e.emailOtpPrompt,surface:e.surface}).handle}async function Or({ctx:e,summary:t,txSigningRequests:n,model:r,securityContext:i,loading:a,theme:o,appearance:s,uiMode:c,onMounted:l,signingAuthMode:u,emailOtpPrompt:d,surface:f}){let p=ar(c);return new Promise(c=>{let m=performance.now(),{handle:h,reused:g}=Er({ctx:e,summary:t,txSigningRequests:n,model:r,securityContext:i,loading:a,theme:o,appearance:s,variant:p,signingAuthMode:u,emailOtpPrompt:d,surface:f}),ee=er(m),te=performance.now(),_=0,v=g?ee:0,y=0,b=e=>e>0?e:er(te);Promise.resolve().then(()=>{_=b(_),g||(v=b(v))});try{l?.(h)}catch{}let x=e=>{let t={kind:`confirm_ui_prompt_diagnostics_v1`,elementDefineMs:0,mountMs:ee,hostFirstUpdateMs:_,hostInteractiveMs:v,confirmEventMs:y,decisionWaitMs:er(te)};ne(),c({...e,handle:h,diagnostics:t})},S=async e=>{if(y=b(y),e.kind===`cancelled`){let t=e.error||void 0;h.update({...t?{errorMessage:t}:{},loading:!1}),x({confirmed:!1,error:t});return}let i,a=await sr(String(r?.intentDigest||t?.intentDigest||``).trim(),n);if(a&&(i=a),i){h.update({errorMessage:i,loading:!1}),x({confirmed:!1,error:i});return}x({confirmed:!0,...e.emailOtp.kind===`provided`?{otpCode:e.emailOtp.code,emailOtpChallengeId:e.emailOtp.challengeId}:{}})},ne=()=>{_=Math.max(_,0)};(async()=>{let e=await h.takeDecision();u===`emailOtp`&&e.kind===`confirmed`&&e.emailOtp.kind===`absent`&&(h.update({loading:!1}),e=await h.takeDecision()),await S(e)})()})}function kr({ctx:e,summary:t,txSigningRequests:n,model:r,securityContext:i,loading:o,theme:s,appearance:c,variant:l,signingAuthMode:u,emailOtpPrompt:d}){a(e.surfaceMeasurementBinding)?.assertPending(),ur();let f=ie({getAppearance:e.getAppearance,requestedAppearance:c,requestedMode:s}),p=dr(),m=mr(e,r),h=xr(a(e.surfaceMeasurementBinding)),g;return g=$n({parent:p,variant:l,context:Ar(e.surfaceMeasurementBinding,l),appearance:f,presentation:{onBack:h.onBack,model:r,securityContext:i,loading:o,title:t?.title??(t?.delegate?`Sign Delegate Action`:void 0),body:t?.body,signingAuthMode:u,emailOtpPrompt:d,nearExplorerUrl:e.nearExplorerUrl??m.nearExplorerUrl,tempoExplorerUrl:e.tempoExplorerUrl??m.tempoExplorerUrl,evmExplorerUrl:e.evmExplorerUrl??m.evmExplorerUrl},tree:L({txSigningRequests:n,model:r}),callbacks:h.callbacks,onClosed:()=>{fr(g.element),pr()}}),Z.set(g.element,g),rr.set(g.element,h),cr(p),yr(g.element,l,e.surfaceMeasurementBinding),gr(g.element,g,r),p.classList.remove(`seams-portal--visible`),requestAnimationFrame(()=>{p.classList.add(`seams-portal--visible`)}),ir(`WALLET_UI_OPENED`),Sr(g,h,e.surfaceMeasurementBinding)}function Ar(e,t){let n=e.kind===`wallet_iframe`?e.hostSurfaceVariant??t:t;return e.kind===`wallet_iframe`&&n===`modal`?`wallet-iframe`:`standalone`}function jr(e,t){if(typeof e==`bigint`)return e;let n=String(e??t??`0`).trim();if(!n)return 0n;try{return BigInt(n)}catch{return 0n}}function Mr(e){if(!t(e))return null;let n=String(e.kind||``).trim(),r=String(e.walletId||``).trim(),i=String(e.nearAccountId||``).trim(),a=String(e.nearPublicKeyStr||``).trim();if(!r||!i||!a)return null;switch(n){case`implicit_unfunded`:return{kind:n,walletId:r,nearAccountId:i,nearPublicKeyStr:a};case`access_key_available`:case`sponsored_named_ready`:return{kind:n,walletId:r,nearAccountId:i,nearPublicKeyStr:a,nonce:jr(e.nonce,e.nextNonce),accessKeyNonce:String(e.accessKeyNonce||``).trim(),nextNonce:String(e.nextNonce||``).trim(),txBlockHeight:String(e.txBlockHeight||``).trim(),txBlockHash:String(e.txBlockHash||``).trim()};case`account_lookup_failed`:return{kind:n,walletId:r,nearAccountId:i,nearPublicKeyStr:a,message:String(e.message||``).trim()};default:return null}}function Nr(e){return t(e)?Mr(e.readiness):null}function Pr(e,t){return e.walletId===String(t.subject.walletId)&&e.nearAccountId===String(t.subject.nearAccountId)&&e.nearPublicKeyStr===t.subject.nearPublicKeyStr}async function Fr(e,t){try{let{context:n,leases:r}=await e.nonceCoordinator.reserveNearContext({lane:_({chains:e.chains,walletId:String(t.subject.walletId),nearAccountId:String(t.subject.nearAccountId),nearPublicKeyStr:t.subject.nearPublicKeyStr}),operation:t.operation,count:t.signatureUses,nearClient:e.nearClient});return{kind:`readiness`,readiness:{kind:`context_ready`,transactionContext:{...n},nonceLeases:r.map(u)},reservedNonceLeases:r}}catch(e){let n=Nr(e);return n?.kind===`implicit_unfunded`&&Pr(n,t)?{kind:`readiness`,readiness:{kind:`funding_required`,request:t},reservedNonceLeases:[]}:{kind:`failed`,error:n?.kind===`account_lookup_failed`?`NEAR_ACCOUNT_LOOKUP_FAILED`:`NEAR_CONTEXT_UNAVAILABLE`,details:l(e)}}}async function Ir(e,t){t?.length&&await Promise.all(t.map(t=>e.nonceCoordinator.release({leaseId:t.leaseId,operationId:t.operationId,operationFingerprint:t.operationFingerprint,reason:`cancelled`})))}async function Lr({ctx:e,nearAccountId:t,challengeB64u:n,onBeforePrompt:r,includeSecondPrfOutput:i=!1}){return v({credentialStore:e.webauthnCredentialStore,touchIdPrompt:e.touchIdPrompt,nearAccountId:t,challengeB64u:n,includeSecondPrfOutput:i,onBeforePrompt:r})}function Rr(e,t){t?.close?.(e)}function zr(e){return{chains:e.chains,getAppearance:e.getAppearance,nearExplorerUrl:e.nearExplorerUrl,tempoExplorerUrl:e.tempoExplorerUrl,evmExplorerUrl:e.evmExplorerUrl,surfaceMeasurementBinding:e.surfaceMeasurementBinding}}function Br(){return{kind:`confirm_ui_prompt_diagnostics_v1`,elementDefineMs:0,mountMs:0,hostFirstUpdateMs:0,hostInteractiveMs:0,confirmEventMs:0,decisionWaitMs:0}}async function Vr(e){let t=performance.now(),n=await Dr({ctx:zr(e.ctx),summary:e.transactionSummary,txSigningRequests:e.txSigningRequests,model:e.model,securityContext:e.securityContext,loading:e.loading??!0,theme:e.theme,uiMode:e.confirmationConfig.uiMode,signingAuthMode:e.signingAuthMode,emailOtpPrompt:e.emailOtpPrompt,surface:e.surface}),r=Math.max(0,Math.round(performance.now()-t));e.onMounted?.(n);let i=performance.now();await new Promise(t=>setTimeout(t,e.confirmationConfig.autoProceedDelay));let a=Math.max(0,Math.round(performance.now()-i));return{confirmed:!0,confirmHandle:n,diagnostics:{...Br(),mountMs:r,decisionWaitMs:a}}}async function Hr(e){let{confirmed:t,handle:n,error:r,otpCode:i,emailOtpChallengeId:a,diagnostics:o}=await Or({ctx:zr(e.ctx),summary:e.transactionSummary,txSigningRequests:e.txSigningRequests,model:e.model,securityContext:e.securityContext,loading:e.loading,theme:e.theme,uiMode:e.confirmationConfig.uiMode,onMounted:e.onMounted,signingAuthMode:e.signingAuthMode,emailOtpPrompt:e.emailOtpPrompt,surface:e.surface});return e.request.type===S.SIGN_TRANSACTION&&N(e.request).signingKind===`transaction`&&d(`near`,{event:`near_confirmation_prompt_timing`,mountMs:o.mountMs,decisionWaitMs:o.decisionWaitMs,confirmed:t}),{confirmed:t,confirmHandle:n,error:r,otpCode:i,emailOtpChallengeId:a,diagnostics:o}}async function Ur({ctx:e,request:t,confirmationConfig:n,transactionSummary:r,securityContext:i,loading:a,theme:o,surface:s,onMounted:c}){if(s.kind===`preparation_cancelled`)return{confirmed:!1,confirmHandle:void 0,diagnostics:Br()};let l=t.type===S.SIGN_TRANSACTION?N(t).txSigningRequests:[],u=De(t),d=Oe(t),f=ke(t);switch(n.kind){case`silent`:return s.kind===`reuse_mounted`&&s.handle.close(!0),{confirmed:!0,confirmHandle:void 0,diagnostics:Br()};case`auto_proceed`:return await Vr({ctx:e,request:t,confirmationConfig:n,transactionSummary:r,securityContext:i,loading:a,theme:o,surface:s,onMounted:c,txSigningRequests:l,model:u,signingAuthMode:d,emailOtpPrompt:f});case`interactive`:return await Hr({ctx:e,request:t,confirmationConfig:n,transactionSummary:r,securityContext:i,loading:a,theme:o,surface:s,onMounted:c,txSigningRequests:l,model:u,signingAuthMode:d,emailOtpPrompt:f});default:return _e(n)}}function Wr(e){return{near:{fetchNearContext:t=>Fr(e,t),releaseReservedNonces:t=>Ir(e,t)},security:{getRpId:()=>e.touchIdPrompt.getRpId()},webauthn:{collectAuthenticationCredentialWithPRF:t=>Lr({ctx:e,...t}),createRegistrationCredential:t=>e.touchIdPrompt.generateRegistrationCredentialsInternal(t)},ui:{renderConfirmUI:t=>Ur({ctx:e,...t}),closeModalSafely:Rr}}}function Gr({adapters:e,worker:t,request:n,confirmationConfig:r,transactionSummary:i,theme:a,surface:o}){let s,c;return{setNonceLeases:e=>{s=e},updateUI:e=>{c?.update?.(e)},promptUser:async({securityContext:t,loading:s,onMounted:l})=>{let{confirmed:u,confirmHandle:d,error:f,otpCode:p,emailOtpChallengeId:m,diagnostics:h}=await e.ui.renderConfirmUI({request:n,confirmationConfig:r,transactionSummary:i,securityContext:t,loading:s,theme:a,surface:o,onMounted:e=>{c=e,l?.(e)}});return c=d,{confirmed:u,error:f,otpCode:p,emailOtpChallengeId:m,diagnostics:h}},dismissReviewSurface:()=>{e.ui.closeModalSafely(!0,c),c=void 0},confirmAndCloseModal:n=>{try{Ie(t,n)}finally{n.confirmed||e.near.releaseReservedNonces(s),e.ui.closeModalSafely(!!n.confirmed,c)}}}}export{Oe as C,ge as D,he as E,N as S,we as T,ye as _,H as a,be as b,Ve as c,Fe as d,Re as f,Ie as g,Le as h,vn as i,Be as l,Me as m,Wr as n,ct as o,je as p,Cr as r,dt as s,Gr as t,Ne as u,ve as v,Te as w,Ce as x,Ee as y};
@@ -0,0 +1 @@
1
+ import{j as e}from"./chains-CPmd4s9f.js";function t(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} must be an object`);return e}function n(t,n){let r=e(t,n);switch(r){case`sent`:case`reused`:return r;default:throw Error(`${n} must be sent or reused`)}}function r(e,t){return{kind:`provider`,status:e,emailHint:t}}function i(i,a){let o=t(i,a),s=e(o.kind,`${a}.kind`),c=n(o.status,`${a}.status`),l=e(o.emailHint,`${a}.emailHint`);switch(s){case`provider`:case`development`:if(o.otpCode!==void 0)throw Error(`${a}.otpCode is only valid for code-bearing delivery`);return r(c,l);case`demo_code_response`:case`provider_and_demo_code`:{let t=e(o.otpCode,`${a}.otpCode`);if(!/^\d{6}$/.test(t))throw Error(`${a}.otpCode must be a 6-digit code`);return{kind:s,status:c,emailHint:l,otpCode:t}}default:throw Error(`${a}.kind is invalid`)}}function a(e){switch(e.kind){case`provider`:return null;case`demo_code_response`:case`provider_and_demo_code`:return e.otpCode}}export{i as n,a as t};
@@ -0,0 +1 @@
1
+ import{P as e,r as t}from"./domainIds-C3fUa33Q.js";import{t as n}from"./accountIds-BzZs7YoX.js";import{c as r,o as i}from"./ecdsaChainTarget-svSlzhze.js";import{Bt as a,T as o,g as s}from"./emailOtpEcdsaDerivationIdentity-DreNrM6n.js";import{i as c,t as l}from"./signerSlot-CpyIfl3J.js";import{c as u,s as d}from"./types-BrEW276O.js";import{a as f,k as p}from"./nearEd25519YaoSigningPreparation-BgCxoh9S.js";function m(e){let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?null:t.toString(10).padStart(20,`0`)}function h(e,t){if(e.length===0)return{kind:`no_current_lane`,unusableFacts:[]};let n=_(e,t),r=v(n,t);if(r.length)return{kind:`conflicting_key_material`,conflicts:r};if(n.length!==1)return{kind:`ambiguous_material`,candidates:e};let i=n[0];return i?g(i,t.supersession):{kind:`no_current_lane`,unusableFacts:[]}}function g(e,t){let n=e.facts.filter(t.isOperationUsable);if(n.length===0)return{kind:`no_current_lane`,unusableFacts:e.facts};let r=y(n,t);return r.kind===`ambiguous`?{kind:`ambiguous_material`,candidates:r.candidates}:{kind:`selected`,selectedFact:r.fact,supersededFacts:e.facts.filter(e=>e!==r.fact)}}function _(e,t){let n=new Map;for(let r of e){let e=t.groupKey(r),i=t.groupKeyString(e),a=n.get(i);n.set(i,a?{groupKey:a.groupKey,facts:[...a.facts,r]}:{groupKey:e,facts:[r]})}return[...n.values()]}function v(e,t){return e.flatMap(e=>t.groupConflicts(e.facts))}function y(e,t){let n=e[0];if(n===void 0)return{kind:`ambiguous`,candidates:[]};let r=n;for(let n of e.slice(1)){let e=b(r,n,t);switch(e.kind){case`left`:break;case`right`:r=n;break;case`ambiguous`:return{kind:`ambiguous`,candidates:e.candidates};default:return e}}return{kind:`selected`,fact:r}}function b(e,t,n){let r=x(e,t,n);if(r.kind!==`equal`)return r;let i=S(e,t,n);if(i.kind!==`equal`)return i;let a=n.tieBreak(e,t);switch(a){case 1:return{kind:`left`};case-1:return{kind:`right`};case 0:return{kind:`ambiguous`,candidates:[e,t]};default:return a}}function x(e,t,n){let r=n.generation(e),i=n.generation(t);return!r||!i?{kind:`ambiguous`,candidates:[e,t]}:r>i?{kind:`left`}:i>r?{kind:`right`}:{kind:`equal`}}function S(e,t,n){let r=n.exactness(e);return r===n.exactness(t)?{kind:`equal`}:r===`exact_target`?{kind:`left`}:{kind:`right`}}function C(e){return{kind:`ed25519_durable_material`,authMethod:e.authMethod,materialActivation:e.materialActivation}}function w(e){return[e.activationId,e.capability,e.materialOwner,e.keyBinding,e.lifecycleBinding,e.signingWorker].map(e=>encodeURIComponent(String(e))).join(`:`)}function T(e){let t={source:e.source,runtime:e.runtime,key:e.key,materialActivation:e.materialActivation,publicFacts:e.publicFacts,curve:`ecdsa`,chainTarget:e.chainTarget,state:e.state,authorizationState:e.authorizationState};if(e.auth.kind===`passkey`){if(!e.resolvedKey)throw Error(`active Wallet Authority passkey lane is missing its resolved ECDSA key`);return{...t,auth:e.auth,resolvedKey:e.resolvedKey}}return{...t,auth:e.auth}}function ee(e){let t=e.authorization;return t?e.remainingUses===t.runtime.remainingUses&&e.expiresAtMs===t.runtime.expiresAtMs:!0}function E(e){return u(e.auth)}function D(e){return u(e.auth)}function O(e){let t=e.ed25519Restore;if(e.authMethod===`passkey`){if(!t.credentialIdB64u)return null;try{return{kind:`passkey`,rpId:o(t.rpId),credentialIdB64u:t.credentialIdB64u}}catch{return null}}return t.providerSubjectId?{kind:`email_otp`,providerSubjectId:t.providerSubjectId}:null}function k(e){let{authorization:t}=e;if(String(t.session.walletId)!==e.walletId||t.selectedAuthMethod.kind!==e.auth.kind||t.operationCredential.walletSessionId.length===0||t.session.quotaId.length===0||!f({session:t.session,materialActivation:e.materialActivation}))return!1;if(e.auth.kind===`passkey`){if(t.selectedAuthMethod.kind!==`passkey`||String(t.selectedAuthMethod.rpId)!==String(e.auth.rpId)||t.selectedAuthMethod.credentialIdB64u!==e.auth.credentialIdB64u)return!1}else if(t.selectedAuthMethod.kind!==`email_otp`||t.selectedFactorAuthority.factor.kind!==`email_otp`||t.selectedFactorAuthority.factor.providerUserId!==e.auth.providerSubjectId)return!1;return!!(e.ownerScope&&d(e.auth)===d(e.ownerScope.auth))}function te(e,t,i){if(e.curve!==`ed25519`)return null;let a=String(e.thresholdSessionIds.ed25519||``).trim(),o=String(e.walletId||``).trim(),s=e.ed25519Restore,u=l(s.signerSlot),d=O(e);if(!a||!o||u===null||!d)return null;let f=Math.floor(Number(e.expiresAtMs)||0),p=Math.max(0,Math.floor(Number(e.remainingUses)||0)),m=f>0&&f<=Date.now()?`expired`:p===0?`exhausted`:`restorable`,h=t&&k({authorization:t,auth:d,walletId:o,materialActivation:s.materialActivation,ownerScope:i})?t:null;try{let t={auth:d,curve:`ed25519`,chain:`near`,materialActivation:s.materialActivation,walletId:r(o),nearAccountId:n(s.nearAccountId),nearEd25519SigningKeyId:c(s.nearEd25519SigningKeyId),signerSlot:u,source:`durable_sealed_record`,thresholdSessionId:a,remainingUses:p,...f>0?{expiresAtMs:f}:{},updatedAtMs:Math.floor(Number(e.updatedAtMs)||0),...P(e)?{policyHint:P(e)}:{}};return h?{...t,state:m,authorizationState:`authorized`,authorization:h}:{...t,state:`deferred`,authorizationState:`authorization_required`}}catch{return null}}function ne(e){return e.auth.kind===`email_otp`}function re(e,t,i){let a=String(e.walletId||``).trim(),o=String(e.nearAccountId||``).trim(),s=String(e.thresholdSessionId||``).trim();if(!a||!o||!s)return null;let c=t&&k({authorization:t,auth:e.auth,walletId:a,materialActivation:e.materialActivation,ownerScope:i})?t:null;try{let t={auth:e.auth,curve:`ed25519`,chain:`near`,materialActivation:e.materialActivation,walletId:r(a),nearAccountId:n(o),nearEd25519SigningKeyId:e.nearEd25519SigningKeyId,signerSlot:e.signerSlot,thresholdSessionId:s,source:`public_capability_reference`};if(!c)return{...t,state:`deferred`,authorizationState:`authorization_required`};let i=Math.floor(Number(c.status.expiresAtMs)||0),l=ne(e)?e:null,u=l?Math.min(l.expiresAtMs,i):i,d=u>0&&u<=Date.now()?`expired`:`ready`;return{...t,state:d,authorizationState:`authorized`,authorization:c,remainingUses:c.status.remainingUses,...u>0?{expiresAtMs:u}:{}}}catch{return null}}function A(e){if(e.state===`missing`)return!1;if(e.curve!==`ecdsa`){let t=String(e.thresholdSessionId||``).trim();return e.thresholdSessionId!==t||!t?!1:e.authorizationState===`authorization_required`?e.state===`deferred`:!e.authorization.operationCredential.walletSessionId||!e.authorization.session.quotaId||e.authorization.status.remainingUses<=0||e.authorization.status.expiresAtMs<=Date.now()?!1:e.auth.kind===`email_otp`||e.auth.kind===`passkey`}return e.auth.kind!==`email_otp`&&e.auth.kind!==`passkey`||e.source===`active_wallet_authority`&&(e.state!==`deferred`||e.authorizationState!==`authorization_required`||e.runtime.kind!==`active_wallet_authority_ecdsa_runtime_v1`||String(e.runtime.walletId)!==String(e.key.walletId)||!t(e.runtime.materialActivation,e.materialActivation)||e.runtime.publicFacts!==e.publicFacts)||!(e.key&&String(e.key.walletId||``).trim()&&String(e.key.ecdsaThresholdKeyId||``).trim()&&String(e.key.signingRootId||``).trim()&&String(e.key.signingRootVersion||``).trim()&&Array.isArray(e.key.participantIds)&&e.key.participantIds.length>0&&String(e.key.thresholdOwnerAddress||``).trim()&&`publicFacts`in e&&e.publicFacts&&e.publicFacts.keyHandle&&String(e.publicFacts.publicKeyB64u||``).trim()&&Array.isArray(e.publicFacts.participantIds)&&e.publicFacts.participantIds.length>0&&String(e.publicFacts.thresholdOwnerAddress||``).trim())||e.source===`canonical_capability`&&!ee(e)?!1:u(e.auth)===`passkey`?e.resolvedKey?.kind===`resolved_evm_family_ecdsa_key`&&e.resolvedKey.authBinding.kind===`passkey_ecdsa_auth_binding`&&String(e.resolvedKey.walletId)===String(e.key.walletId)&&e.resolvedKey.publicFacts===e.publicFacts:!(`resolvedKey`in e)}function j(e){return e===`missing`?null:e}function ie(e){return e||`unknown`}function ae(e){let t=Math.floor(Number(e));return Number.isFinite(t)&&t>0?t:null}function oe(e){let t=Math.max(0,Math.floor(Number(e)));return Number.isFinite(t)?t:null}function se(e){if(!A(e.lane)||e.lane.curve!==`ed25519`)return null;let t=j(e.lane.state);if(!t)return null;let n={kind:`lane_candidate`,walletId:e.lane.walletId,nearAccountId:e.lane.nearAccountId,nearEd25519SigningKeyId:e.lane.nearEd25519SigningKeyId,signerSlot:e.lane.signerSlot,materialActivation:e.lane.materialActivation,auth:e.lane.auth,curve:`ed25519`,chain:`near`,thresholdSessionId:e.lane.thresholdSessionId,state:t,remainingUses:oe(e.lane.remainingUses),expiresAtMs:ae(e.lane.expiresAtMs),updatedAtMs:ae(e.lane.updatedAtMs),source:ie(e.lane.source)};return e.lane.authorizationState===`authorization_required`?{...n,authorizationState:`authorization_required`,state:`deferred`}:{...n,authorizationState:`authorized`,authorization:e.lane.authorization}}function ce(e){if(!A(e.lane)||e.lane.curve!==`ecdsa`)return null;let t=j(e.lane.state);if(!t)return null;let n=u(e.lane.auth),i={kind:`lane_candidate`,walletId:r(e.walletId),auth:e.lane.auth,authMethod:n,curve:`ecdsa`,chain:e.lane.chainTarget.kind,key:e.lane.key,materialActivation:e.lane.materialActivation,...n===`passkey`?{resolvedKey:e.lane.resolvedKey}:{},keyHandle:e.lane.publicFacts.keyHandle,chainTarget:e.lane.chainTarget};switch(e.lane.source){case`active_wallet_authority`:return{...i,source:`active_wallet_authority`,runtime:e.lane.runtime,authorizationState:`authorization_required`,state:`deferred`};case`canonical_capability`:return e.lane.authorization?{...i,source:`canonical_capability`,authorizationState:`authorized`,authorization:e.lane.authorization,state:t}:{...i,source:`canonical_capability`,authorizationState:`authorization_required`,state:`deferred`};default:return e.lane}}function le(e){if(!e||e.curve!==`ecdsa`||!e.chainTarget||!(`key`in e)||!e.key||!(`auth`in e)||!e.auth)return null;let t=u(e.auth);try{let n=d(e.auth);return[t,`ecdsa`,i(e.chainTarget),n,ue(e),w(e.materialActivation)].join(`:`)}catch{return null}}function ue(e){return s({walletId:e.key.walletId,publicFacts:e.publicFacts})}function M(e){if(!e||e.curve!==`ed25519`||e.chain!==`near`||e.state===`missing`||!e.auth)return null;let t=u(e.auth),n=String(e.walletId||``).trim(),r=String(e.nearAccountId||``).trim(),i=String(e.nearEd25519SigningKeyId||``).trim(),a=String(e.signerSlot||``).trim(),o=String(e.thresholdSessionId||``).trim(),s=e.materialActivation?w(e.materialActivation):``;return!t||!n||!r||!i||!a||!o||!s?null:[n,r,i,a,t,`ed25519`,`near`,o,s].join(`:`)}function N(e){return{curve:`ecdsa`,chainTarget:e.chainTarget,state:`missing`}}function de(e,t){let n=i(t);return e.ecdsa.lanesByTarget[n]||N({chainTarget:t})}function fe(e,t){let n=i(t);return e.ecdsa.candidatesByTarget[n]||[]}function pe(){return{curve:`ed25519`,chain:`near`,state:`missing`}}function P(e){let t=Math.floor(Number(e.remainingUses)),n=Math.floor(Number(e.expiresAtMs)),r={};return Number.isFinite(t)&&t>=0&&(r.remainingUses=t),Number.isFinite(n)&&n>0&&(r.expiresAtMs=n),Object.keys(r).length?r:void 0}function F(e){return Math.floor(Number(`updatedAtMs`in e?e.updatedAtMs:0)||0)}function I(e){return m(e.expiresAtMs??e.policyHint?.expiresAtMs)}function L(e){switch(e.state){case`ready`:return 5;case`restorable`:return 4;case`deferred`:return 3;case`expired`:case`exhausted`:return 2;case`missing`:return 1}}function R(e){return!A(e)||e.curve===`ecdsa`?0:e.source===`durable_sealed_record`?1:0}function z(e,t){return L(e)-L(t)||R(e)-R(t)||F(e)-F(t)}function me(e,t){return z(e,t)}function he(e,t){return L(e)-L(t)||R(e)-R(t)||F(e)-F(t)}function B(e){let t=d(e.auth),n=String(e.walletId||``).trim(),r=String(e.nearAccountId||``).trim(),i=String(e.nearEd25519SigningKeyId||``).trim(),a=String(e.signerSlot||``).trim(),o=w(e.materialActivation);return!t||!n||!r||!i||!a||!o?null:{walletId:n,authKey:t,nearAccountId:r,nearEd25519SigningKeyId:i,signerSlot:a,materialActivationKey:o}}function V(e){return[e.walletId,e.authKey,e.nearAccountId,e.nearEd25519SigningKeyId,e.signerSlot,e.materialActivationKey].map(e=>encodeURIComponent(e)).join(`|`)}function ge(e){if(!A(e)||e.curve!==`ed25519`)return null;let t=B(e);return t?{groupKey:t,lane:e}:null}function H(e,t){return me(t,e)}function U(e,t){return e>t?1:t>e?-1:0}function W(e,t){let n=e.localeCompare(t);return n>0?1:n<0?-1:0}function G(e){for(let t of e)if(t!==0)return t;return 0}function _e(e){return[]}function ve(e){return!0}function ye(e){return I(e.lane)}function be(){return`exact_target`}function xe(e,t){return G([U(L(e.lane),L(t.lane)),U(R(e.lane),R(t.lane)),W(Se(e.lane),Se(t.lane))])}function Se(e){return[e.thresholdSessionId,e.authorizationState===`authorized`?e.authorization.operationCredential.walletSessionId:``,e.authorizationState===`authorized`?e.authorization.session.quotaId:``,e.source||`durable_sealed_record`].map(e=>String(e)).join(`|`)}const Ce={groupKey:we,groupKeyString:V,groupConflicts:_e,supersession:{isOperationUsable:ve,generation:ye,exactness:be,tieBreak:xe}};function we(e){return e.groupKey}function Te(e){let t=new Map;for(let n of e){let e=V(n.groupKey);t.set(e,[...t.get(e)||[],n])}return t}function Ee(e,t){let n=h(e,Ce);switch(n.kind){case`selected`:return[n.selectedFact.lane];case`no_current_lane`:return[];case`conflicting_key_material`:return t.push({curve:`ed25519`,source:`canonical_lane_inventory`,reason:`conflicting_key_material`,message:`Ed25519 canonical lane inventory has conflicting material facts`}),[];case`ambiguous_material`:return t.push({curve:`ed25519`,source:`canonical_lane_inventory`,reason:`ambiguous_material`,message:`Ed25519 canonical lane inventory has incomparable usable records`}),[];default:return n}}function De(e,t){let n=e.map(ge).filter(e=>e!==null),r=[];for(let e of Te(n).values())r.push(...Ee(e,t));return r.sort(H)}function Oe(e){if(!A(e)||e.curve!==`ed25519`)return null;let t=String(e.thresholdSessionId||``).trim();return e.authorizationState!==`authorized`||!t?null:`${e.authorization.operationCredential.walletSessionId}:${e.authorization.session.quotaId}:${t}`}function ke(e){if(!A(e.primaryLane)||e.primaryLane.curve!==`ed25519`||D(e.primaryLane)!==`passkey`)return e.primaryLane;let t=Oe(e.primaryLane);return t&&e.candidates.find(e=>A(e)&&e.curve===`ed25519`&&D(e)===`email_otp`&&Oe(e)===t)||e.primaryLane}function Ae(){try{return globalThis.localStorage?.getItem(`seams:debug:signing-session`)===`1`}catch{return!1}}function K(e){return e?A(e)?{present:!0,authMethod:u(e.auth),curve:e.curve,keyHandle:e.publicFacts.keyHandle,walletId:e.key.walletId,chainTarget:e.chainTarget,targetKey:i(e.chainTarget),state:e.state,source:e.source,evmFamilyKeyFingerprint:ue(e),ecdsaThresholdKeyId:e.key.ecdsaThresholdKeyId,participantIds:e.publicFacts.participantIds,thresholdOwnerAddress:e.publicFacts.thresholdOwnerAddress,remainingUses:e.remainingUses,expiresAtMs:e.expiresAtMs,updatedAtMs:e.updatedAtMs}:{present:!0,curve:e.curve,chainTarget:e.chainTarget,state:e.state}:{present:!1}}function je(e){switch(e.source){case`canonical_capability`:return`canonical_capability`;case`active_wallet_authority`:return`active_wallet_authority`;default:return e}}function Me(e){let t=d(e.auth);return{walletId:String(e.key.walletId),authKey:t,materialActivationKey:w(e.materialActivation),ecdsaThresholdKeyId:String(e.key.ecdsaThresholdKeyId),signingRootId:String(e.key.signingRootId),signingRootVersion:String(e.key.signingRootVersion||`default`)}}function Ne(e){return[e.walletId,e.authKey,e.materialActivationKey,e.ecdsaThresholdKeyId,e.signingRootId,e.signingRootVersion].map(e=>encodeURIComponent(e)).join(`|`)}function Pe(e){let t=Me(e);return t?{source:je(e),groupKey:t,chainTargetKey:i(e.chainTarget),lane:e}:null}function Fe(e){let t=d(e.auth);return[String(e.key.walletId),t,w(e.materialActivation),String(e.key.signingRootId),String(e.key.signingRootVersion||`default`)].map(e=>encodeURIComponent(e)).join(`|`)}function q(e,t){return[...new Set(e.map(e=>t(e.lane)).filter(Boolean))].sort()}function Ie(e){return[{field:`ecdsaThresholdKeyId`,values:q(e.facts,e=>String(e.key.ecdsaThresholdKeyId||``))},{field:`thresholdOwnerAddress`,values:q(e.facts,e=>String(e.publicFacts.thresholdOwnerAddress||``).toLowerCase())},{field:`keyHandle`,values:q(e.facts,e=>String(e.publicFacts.keyHandle||``))},{field:`publicKeyB64u`,values:q(e.facts,e=>String(e.publicFacts.publicKeyB64u||``))},{field:`participantIds`,values:q(e.facts,e=>e.publicFacts.participantIds.map(e=>Number(e)).join(`,`))}].filter(e=>e.values.length>1).map(t=>({groupKey:e.key,field:t.field,values:t.values}))}function Le(e){let t=new Map;for(let n of e){let e=Fe(n.lane);e&&t.set(e,[...t.get(e)||[],n])}let n=new Map;for(let[e,r]of t){let t=r[0];if(!t)continue;let i=Ie({key:t.groupKey,facts:r});i.length&&n.set(e,i)}return n}function Re(e){let t=Fe(e.fact.lane);return t&&e.conflictsByFamilyGroup.get(t)||[]}function ze(e){return e.filter(e=>A(e)&&e.curve===`ecdsa`).map(Pe).filter(e=>e!==null)}function Be(e){return e.source===`active_wallet_authority`?2:1}function Ve(e){return e.groupKey}function He(e){let t=e[0];return t?Ie({key:t.groupKey,facts:e}):[]}function Ue(e){return e.lane.source===`active_wallet_authority`?!0:e.lane.state!==`deferred`||!e.lane.authorization}function We(e){return I(e.lane)}function Ge(e){return`exact_target`}function J(e){return[w(e.materialActivation),e.source,i(e.chainTarget)].map(e=>String(e)).join(`|`)}function Ke(e,t){return G([U(L(e.lane),L(t.lane)),U(Be(e.lane),Be(t.lane)),W(J(e.lane),J(t.lane))])}const qe={groupKey:Ve,groupKeyString:Ne,groupConflicts:He,supersession:{isOperationUsable:Ue,generation:We,exactness:Ge,tieBreak:Ke}};function Je(e){let t=new Map;for(let n of e)t.set(Ne(n.groupKey),n.groupKey);return[...t.values()]}function Ye(e){let t=h(e,qe);switch(t.kind){case`selected`:return{kind:`selected`,selectedFact:t.selectedFact,supersededFacts:t.supersededFacts};case`no_current_lane`:return{kind:`no_current_lane`,unusableFacts:t.unusableFacts};case`conflicting_key_material`:return{kind:`conflicting_key_material`,conflicts:t.conflicts};case`ambiguous_material`:return{kind:`ambiguous_material`,candidates:Je(t.candidates),candidateFacts:t.candidates};default:return t}}function Xe(e){return A(e)?J(e):null}function Ze(e){let t={},n={},r=Object.fromEntries(Object.entries(e.candidatesByTarget).map(([e,t])=>[e,Qe(t,Xe)])),a=Le(Object.values(r).flatMap(ze));for(let o of e.targets){let s=i(o),c=ze(r[s]||[]),l=c.flatMap(e=>Re({fact:e,conflictsByFamilyGroup:a}));if(l.length){e.invalidLanes.push({curve:`ecdsa`,source:`canonical_lane_inventory`,reason:`conflicting_key_material`,targetKey:s,groupKey:l[0]?.groupKey,conflicts:l}),t[s]=[],n[s]=N({chainTarget:o});continue}let u=Ye(c);switch(u.kind){case`selected`:t[s]=[u.selectedFact.lane],n[s]=u.selectedFact.lane;break;case`no_current_lane`:t[s]=[],n[s]=N({chainTarget:o});break;case`conflicting_key_material`:e.invalidLanes.push({curve:`ecdsa`,source:`canonical_lane_inventory`,reason:`conflicting_key_material`,targetKey:s,groupKey:u.conflicts[0]?.groupKey,conflicts:u.conflicts}),t[s]=[],n[s]=N({chainTarget:o});break;case`ambiguous_material`:e.invalidLanes.push({curve:`ecdsa`,source:`canonical_lane_inventory`,reason:`ambiguous_material`,targetKey:s}),t[s]=[],n[s]=N({chainTarget:o});break}}return{lanesByTarget:n,candidatesByTarget:t}}function Qe(e,t,n=z){let r=new Map,i=[];for(let n of e){let e=t(n);if(!e){i.push(n);continue}r.set(e,[...r.get(e)||[],n])}return[...[...r.values()].map(e=>[...e].sort((e,t)=>n(t,e))[0]),...i]}function $e(e){let t=new Set(e.filter(e=>A(e)&&e.curve===`ed25519`&&e.source===`durable_sealed_record`&&(e.state===`ready`||e.state===`restorable`)).map(B).filter(e=>e!==null).map(V));return t.size?e.filter(e=>{if(!A(e)||e.curve!==`ed25519`||e.source!==`public_capability_reference`)return!0;let n=B(e);return!n||!t.has(V(n))}):[...e]}async function et(e,t){return e.state===`missing`||d(e.auth)!==d(t.auth)||!await rt(e,t)?!1:t.auth.kind===`email_otp`?!0:`keyFamily`in t&&t.keyFamily===`ecdsa`?!1:e.signerSlot===t.signerSlot}function tt(e,t){return e.state===`missing`||d(e.auth)!==d(t.auth)?!1:nt(e,t)}function nt(e,t){let n=t.auth.kind===`email_otp`?t.ownerAuthority:void 0;if(!n)return!0;if(e.curve===`ecdsa`&&e.source===`active_wallet_authority`)return e.runtime.factorAuthorityRef.walletAuthMethodId===n.walletAuthMethodId&&String(e.runtime.factorAuthorityRef.authorityDigest)===String(n.authorityDigest);if(e.curve===`ecdsa`&&e.source===`canonical_capability`){let t=e.capability.manifest.signer.authority;return t.walletAuthMethodId===n.walletAuthMethodId&&String(t.authorityDigest)===String(n.authorityDigest)}return!1}async function rt(e,t){let n=t.auth.kind===`email_otp`?t.ownerAuthority:void 0;if(!n)return!0;if(e.state===`missing`||e.curve!==`ed25519`)return!1;if(e.authorizationState===`authorization_required`)return!0;try{let t=await a({authority:e.authorization.selectedFactorAuthority});return t.walletId===e.walletId&&t.walletAuthMethodId===n.walletAuthMethodId&&t.authorityDigest===n.authorityDigest}catch{return!1}}async function it(e,t){let n=[];for(let r of e)await et(r,t)&&n.push(r);return n}async function at(e,t){let n=r(e.walletId),a=new Map;for(let t of e.ecdsaChainTargets)a.set(i(t),t);let o=[...a.values()],[s,c,l,d]=await Promise.all([t.listSealedRecordsForWallet({walletId:n,filter:{...e.authMethod?{authMethod:e.authMethod}:{},curve:`ed25519`}}),t.listPublicCapabilityReferences?.()??[],t.readActiveWalletSessionAuthorization?.(n)??{kind:`missing`},o.length>0&&t.listCanonicalEcdsaLanesForWallet?t.listCanonicalEcdsaLanesForWallet({walletId:n}):[]]),f=l.kind===`found`?l.authorization:null,p=[...o],m={},h={},g={};for(let e of p){let t=i(e);m[t]=N({chainTarget:e}),h[t]=[],g[t]=0}let _=[],v=0,y=Ae(),b=[],x=[];for(let t of s){let n=te(t,f,e.ownerScope);if(!n)continue;_.push(n);let r=F(n);v=Math.max(v,r)}for(let r of c){if(String(r.walletId)!==String(n))continue;let i=l.kind===`exhausted`||l.kind===`expired`;if(!t.isPublicCapabilityActive?.(r)&&!i)continue;let a=re(r,f,e.ownerScope);a&&(e.authMethod&&u(a.auth)!==e.authMethod||_.push(a))}for(let t of d){let r=u(t.auth);if(e.authMethod&&r!==e.authMethod||String(t.key.walletId)!==String(n))continue;let o=i(t.chainTarget);if(!a.has(o))continue;h[o]||=[],h[o].push(t);let s=F(t);v=Math.max(v,s),b.push({result:`accepted`,targetKey:o,lane:K(t)})}let S=o.length>0&&t.listActiveWalletAuthorityEcdsaLanesForWallet?await t.listActiveWalletAuthorityEcdsaLanesForWallet({walletId:n,chainTargets:o}):[];for(let t of S){let r=u(t.auth);if(e.authMethod&&r!==e.authMethod||String(t.key.walletId)!==String(n))continue;let o=i(t.chainTarget);a.has(o)&&(h[o]||=[],h[o].push(t),b.push({result:`accepted`,targetKey:o,lane:K(t)}))}let C=e.ownerScope,w=C?await it(_,C):_;if(C)for(let e of Object.keys(h))h[e]=(h[e]||[]).filter(e=>tt(e,C));let T=De(Qe($e(w),M,he).sort(H),x),ee=ke({primaryLane:T[0]||pe(),candidates:T}),E=Ze({targets:p,candidatesByTarget:Ze({targets:p,candidatesByTarget:h,invalidLanes:x}).candidatesByTarget,invalidLanes:x}),D={walletId:n,generation:v,ecdsa:{targets:p,lanesByTarget:E.lanesByTarget,candidatesByTarget:E.candidatesByTarget},lanes:{ed25519:{near:ee}},candidates:{ed25519:{near:T}},diagnostics:{invalidLanes:x}},O=p.map(e=>{let t=i(e),n=D.ecdsa.candidatesByTarget[t]||[],r=D.ecdsa.lanesByTarget[t],a=r?.state||`missing`;return n.length>0&&a!==`missing`?null:{chainTarget:e,targetKey:t,candidateCount:n.length,selectedLane:K(r)}}).filter(e=>!!e),k={walletId:n,authMethod:e.authMethod||`any`,requestedTargets:p.map(e=>({chainTarget:e,targetKey:i(e)})),sealedRecordCount:0,runtimeRecordCount:d.length,durableDiscovery:[],runtimeDiscovery:b,resultSelectedLanesByTarget:Object.fromEntries(Object.entries(D.ecdsa.lanesByTarget).map(([e,t])=>[e,K(t)])),resultCandidatesByTarget:Object.fromEntries(Object.entries(D.ecdsa.candidatesByTarget).map(([e,t])=>[e,t.map(e=>K(e))]))};if(y&&O.length>0)try{console.warn(`[SigningLanes][available][ecdsa][missing-candidates]`,JSON.stringify({...k,missingEcdsaTargets:O}))}catch{}if(y)try{console.info(`[SigningLanes][available][ecdsa]`,JSON.stringify(k))}catch{}return D}function Y(t,n){return e(t,{fallback:n,min:1})}function X(e,t){let n=Error(`[SigningEngine] ${t}`);return n.code=e,n}function ot(e,t){let n=e.get(t);if(n)return n;let r={running:!1,items:[]};return e.set(t,r),r}function st(e){e.timeoutHandle&&=(clearTimeout(e.timeoutHandle),null)}async function ct(e,t){let n=e.get(t);if(!(!n||n.running)){n.running=!0;try{for(;n.items.length>0;){let e=n.items.shift();if(e&&!e.isSettled()){if(st(e),e.shouldAbort?.()){e.reject(e.makeCancelledError(`cancelled`));continue}if(Date.now()-e.enqueuedAtMs>e.timeoutMs){e.reject(e.makeTimeoutError(e.timeoutMs));continue}try{await e.run()}catch(t){e.reject(t)}}}}finally{n.running=!1,n.items.length===0&&e.get(t)===n?e.delete(t):n.items.length>0&&ct(e,t)}}}function lt(e){for(let t of e.values()){for(let e of t.items)st(e),e.reject(e.makeCancelledError(`queue_cleared`));t.items.length=0}e.clear()}function ut(e){return[`material`,encodeURIComponent(String(e.materialActivation.materialOwner)),encodeURIComponent(String(e.materialActivation.capability)),encodeURIComponent(String(e.materialActivation.activationId))].join(`:`)}async function dt(e){let{labels:t,owner:n}=e,r=String(e.queueKey||``).trim();if(!r)throw Error(`[SigningEngine] ${t.queue} requires non-empty queueKey`);if(!e.enabled)return await e.task();let i=Y(e.maxQueueLength,8),a=Y(e.queueTimeoutMs,45e3),o=ot(e.queueByKey,r);if(o.items.length+(o.running?1:0)>=i)throw X(`commit_queue_overflow`,`${t.queue} overflow for ${n} (queueKey=${r}, max=${i})`);return await new Promise((i,s)=>{let c=null,l=!1,u=()=>{c&&=(clearTimeout(c),null)},d=e=>{l||(l=!0,u(),s(e))},f=e=>{l||(l=!0,u(),i(e))},p=e=>X(`cancelled`,`${t.queuedOperation} cancelled for ${n} (queueKey=${r}${e===`queue_cleared`?`, queue_cleared`:``})`),m=e=>X(`commit_queue_timeout`,`${t.queue} timeout for ${n} (queueKey=${r}, waited>${e}ms before start)`),h={enqueuedAtMs:Date.now(),timeoutMs:a,shouldAbort:e.shouldAbort,timeoutHandle:null,isSettled:()=>l,reject:d,makeCancelledError:p,makeTimeoutError:m,run:async()=>{if(e.shouldAbort?.())throw p(`cancelled`);f(await e.task())}};c=setTimeout(()=>{if(h.isSettled())return;let t=o.items.indexOf(h);t>=0&&o.items.splice(t,1),d(m(a)),!o.running&&o.items.length===0&&e.queueByKey.get(r)===o&&e.queueByKey.delete(r)},a),h.timeoutHandle=c,o.items.push(h),ct(e.queueByKey,r)})}function Z(e){let t={walletId:p(e.laneIdentity),authMethod:u(e.laneIdentity.auth),laneIdentity:e.laneIdentity};return e.kind===`ecdsa`?{...t,walletSessionId:e.authorization.operationCredential.walletSessionId,quotaId:e.authorization.session.quotaId}:{...t,walletSessionId:e.laneIdentity.walletSessionId,quotaId:e.laneIdentity.quotaId}}function Q(e){return{kind:`invalid`,...Z(e.source)}}function $(e){let t=Number(e);return!Number.isSafeInteger(t)||t<0?null:t}function ft(e){let t=$(e.expiresAtMs),n=$(e.detectedAtMs);if(t===null||t===0)throw Error(`Authoritative expired Wallet Session expiresAtMs is invalid`);if(n===null||n===0)throw Error(`Authoritative expired Wallet Session detectedAtMs is invalid`);if(t>n)throw Error(`Authoritative expired Wallet Session timeline is invalid`);return{kind:`expired`,...Z(e.source),expiresAtMs:t,detectedAtMs:n}}function pt(e){let t=$(e.observation.expiresAtMs);if(t===null||t===0)return Q({source:e.observation.source});let n=Z(e.observation.source);return t<=e.nowMs?{kind:`expired`,...n,expiresAtMs:t,detectedAtMs:e.nowMs}:{kind:`active`,...n,expiresAtMs:t}}function mt(e){let t=$(e.nowMs);if(t===null)return Q({source:e.observation.source});switch(e.observation.kind){case`found`:return pt({observation:e.observation,nowMs:t});case`missing`:return{kind:`missing`,...Z(e.observation.source)};case`unavailable`:return{kind:`unavailable`,...Z(e.observation.source)};case`invalid`:return Q({source:e.observation.source});default:return e.observation}}export{C as _,dt as a,D as c,le as d,ce as f,at as g,A as h,ut as i,fe as l,se as m,ft as n,T as o,M as p,lt as r,E as s,mt as t,de as u,w as v};
@@ -0,0 +1 @@
1
+ import{t as e}from"./accountIds-BzZs7YoX.js";import{i as t,n}from"./profileAccountProjection-C1z9sKHa.js";async function r(e){let[t,n]=await Promise.all([e.credentialStore.listWalletPasskeyAuthenticators(e.walletId),e.credentialStore.listWalletAuthMethodsV2ForWallet(e.walletId)]),r=new Set;for(let t of n)t.kind===`passkey`&&t.status===`active`&&String(t.walletId)===e.walletId&&r.add(t.credentialIdB64u);return t.filter(e=>r.has(e.credentialId))}function i(e){return e.map(e=>({id:String(e.credentialId||``),type:`public-key`,transports:Array.isArray(e.transports)?e.transports:[]}))}function a(e){if(String(e.signerAuthMethod||``)!==`passkey`)return``;let t=String(e.metadata?.walletId||``).trim(),n=String(e.metadata?.passkeyCredentialRawId||``).trim();return t&&n?t:``}async function o(e){let t=await e.credentialStore.listAccountSigners({chainIdKey:e.chainIdKey,accountAddress:e.accountAddress,status:`active`}),n=Array.from(new Set(t.map(a).filter(Boolean)));if(n.length===0)throw Error(`[multichain] no passkey signer found for account ${e.accountLabel}`);if(n.length>1)throw Error(`[multichain] multiple wallet identities found for account ${e.accountLabel}`);let i=n[0];return{walletId:i,authenticators:await r({credentialStore:e.credentialStore,walletId:i})}}async function s(e){if(e.authenticators.length===0)throw Error(`[multichain] no passkeys found for account ${String(e.accountLabel)}`);let t=(await e.credentialStore.selectProfileAuthenticatorsForPrompt({profileId:e.profileId,authenticators:e.authenticators,accountLabel:String(e.accountLabel)})).authenticatorsForPrompt;if(t.length===0)throw Error(`[multichain] no passkey credential selected for account ${String(e.accountLabel)}`);e.onBeforePrompt?.({authenticators:e.authenticators,authenticatorsForPrompt:t,challengeB64u:e.challengeB64u});let n=i(t),r=await e.touchIdPrompt.getAuthenticationCredentialsSerializedForChallengeB64u({subjectId:String(e.accountLabel),challengeB64u:e.challengeB64u,allowCredentials:n,cancellation:e.cancellation,includeSecondPrfOutput:e.includeSecondPrfOutput}),a=await e.credentialStore.selectProfileAuthenticatorsForPrompt({profileId:e.profileId,authenticators:e.authenticators,selectedCredentialRawId:r.rawId,accountLabel:String(e.accountLabel)});if(a?.wrongPasskeyError)throw Error(String(a.wrongPasskeyError));return r}async function c(e){let t=String(e.credentialIdB64u||``).trim();if(!t)throw Error(`[webauthn] exact passkey credential is required`);let n=await e.touchIdPrompt.getAuthenticationCredentialsSerializedForChallengeB64u({subjectId:String(e.accountLabel),challengeB64u:e.challengeB64u,allowCredentials:[{id:t,type:`public-key`,transports:[]}],cancellation:e.cancellation,includeSecondPrfOutput:e.includeSecondPrfOutput});if(n.rawId!==t)throw Error(`[webauthn] authentication returned a different passkey credential`);return n}async function l(t){let n=e(t.nearAccountId);return await c({touchIdPrompt:t.touchIdPrompt,accountLabel:n,challengeB64u:t.challengeB64u,credentialIdB64u:t.credentialIdB64u,cancellation:t.cancellation,includeSecondPrfOutput:t.includeSecondPrfOutput})}async function u(e){let t=String(e.walletId||``).trim();return await c({touchIdPrompt:e.touchIdPrompt,accountLabel:t,challengeB64u:e.challengeB64u,credentialIdB64u:e.credentialIdB64u,cancellation:e.cancellation,includeSecondPrfOutput:e.includeSecondPrfOutput})}async function d(r){let i=e(r.nearAccountId),a=await n(r.credentialStore,t(i));if(!a?.profileId)throw Error(`[multichain] no profile/account mapping found for account ${i}`);let c=await o({credentialStore:r.credentialStore,chainIdKey:a.accountRef.chainIdKey,accountAddress:a.accountRef.accountAddress,accountLabel:i});return await s({credentialStore:r.credentialStore,touchIdPrompt:r.touchIdPrompt,profileId:c.walletId,accountLabel:i,authenticators:c.authenticators,challengeB64u:r.challengeB64u,cancellation:r.cancellation,...r.onBeforePrompt?{onBeforePrompt:r.onBeforePrompt}:{},...typeof r.includeSecondPrfOutput==`boolean`?{includeSecondPrfOutput:r.includeSecondPrfOutput}:{}})}async function f(e){let t=String(e.walletId||``).trim(),n=await r({credentialStore:e.credentialStore,walletId:t});return await s({credentialStore:e.credentialStore,touchIdPrompt:e.touchIdPrompt,profileId:t,accountLabel:t,authenticators:n,challengeB64u:e.challengeB64u,cancellation:e.cancellation,...e.onBeforePrompt?{onBeforePrompt:e.onBeforePrompt}:{},...typeof e.includeSecondPrfOutput==`boolean`?{includeSecondPrfOutput:e.includeSecondPrfOutput}:{}})}export{f as i,l as n,u as r,d as t};
@@ -1 +1 @@
1
- import{a as e}from"./clientSessionPersistenceState-BgO4P6CZ.js";async function t(t){return await e({...t,labels:{queue:`threshold Ed25519 commit queue`,queuedOperation:`threshold Ed25519 queued commit`},owner:String(t.nearAccountId)})}export{t};
1
+ import{a as e}from"./clientSessionPersistenceState-DFGHXoKK.js";async function t(t){return await e({...t,labels:{queue:`threshold Ed25519 commit queue`,queuedOperation:`threshold Ed25519 queued commit`},owner:String(t.nearAccountId)})}export{t};
@@ -1 +1 @@
1
- import{n as e}from"./normalization-C6fQN6mW.js";import{g as t,h as n,m as r,p as i}from"./signingFlow-gl85GOW4.js";function a(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t,2)}catch{return String(e)}}function o(e,t,n){let r=String(t??``).trim();if(r)return{label:e,value:r,...typeof n==`string`&&n.trim()?{copyValue:n}:{}}}function s(t){let n=e(t.input);if(n!==`0x`&&!(!Array.isArray(t.abi)||t.abi.length===0))return{dataHex:n,abi:t.abi}}function c(a){let{rootId:c,call:l,tx:u}=a,d=String(l.to||``).trim(),f=e(String(l.input||`0x`));if(f===`0x`)return;let p=t(f),m=n(p,d)||`contract function`,h=i(u.gasLimit),g=o(`Data`,r(f),f);g&&(g.renderAs=`file-content`,g.hideLabel=!0,g.hideChevron=!0);let _=[g,o(`Value (wei)`,l.value.toString()),o(`Valid Before`,u.validBefore==null?void 0:u.validBefore.toString()),o(`Valid After`,u.validAfter==null?void 0:u.validAfter.toString())].filter(Boolean),v={id:`${c}.call`,kind:`generic.contractCall`,label:`Calling ${m} using ${h} gas`,to:d,value:l.value.toString(),selector:p,fields:_},y=s({input:f,abi:l.abi});return y&&(v.abiDecodeHint=y),v}function l(n){let{call:r,callIndex:i,callCount:a,tx:o}=n,s=`tempo.tx.${i}`,l=String(r.to||``).trim(),u=a>1?`Transaction ${i+1} to contract`:`Transaction to contract`,d=c({rootId:s,call:r,tx:o});return{id:s,kind:`tempo.eip2718`,label:u,txTypeHex:`0x76`,txTypeName:`TempoTransaction`,to:l,selector:t(e(String(r.input||`0x`))),...d?{children:[d]}:{}}}function u(e){if(e.kind!==`tempoTransaction`)return[{id:`tempo.raw`,kind:`raw.fallback`,label:`Unsupported Tempo Payload`,raw:a(e)}];let t=Array.isArray(e.tx.calls)?e.tx.calls:[];return t.length?t.map((n,r)=>l({call:n,callIndex:r,callCount:t.length,tx:e.tx})):[{id:`tempo.raw`,kind:`raw.fallback`,label:`Tempo Payload Missing Calls`,raw:a(e)}]}function d(e){let t=u(e.request),n=BigInt(0);if(e.request.kind===`tempoTransaction`)for(let t of e.request.tx.calls||[])n+=BigInt(t.value||0);return{chain:`tempo`,chainId:e.request.kind===`tempoTransaction`?e.request.tx.chainId:void 0,intentDigest:e.intentDigest,signerAccount:e.signerAccount,title:e.title||`Tempo Transaction`,subtitle:e.subtitle,operations:t,...n>0n?{totals:{nativeValue:n.toString(),nativeSymbol:`wei`}}:{}}}export{d as t};
1
+ import{n as e}from"./normalization-CpLZcL2f.js";import{_ as t,g as n,h as r,m as i}from"./signingFlow-Co_QtuHK.js";function a(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t,2)}catch{return String(e)}}function o(e,t,n){let r=String(t??``).trim();if(r)return{label:e,value:r,...typeof n==`string`&&n.trim()?{copyValue:n}:{}}}function s(t){let n=e(t.input);if(n!==`0x`&&!(!Array.isArray(t.abi)||t.abi.length===0))return{dataHex:n,abi:t.abi}}function c(a){let{rootId:c,call:l,tx:u}=a,d=String(l.to||``).trim(),f=e(String(l.input||`0x`));if(f===`0x`)return;let p=t(f),m=n(p,d)||`contract function`,h=i(u.gasLimit),g=o(`Data`,r(f),f);g&&(g.renderAs=`file-content`,g.hideLabel=!0,g.hideChevron=!0);let _=[g,o(`Value (wei)`,l.value.toString()),o(`Valid Before`,u.validBefore==null?void 0:u.validBefore.toString()),o(`Valid After`,u.validAfter==null?void 0:u.validAfter.toString())].filter(Boolean),v={id:`${c}.call`,kind:`generic.contractCall`,label:`Calling ${m} using ${h} gas`,to:d,value:l.value.toString(),selector:p,fields:_},y=s({input:f,abi:l.abi});return y&&(v.abiDecodeHint=y),v}function l(n){let{call:r,callIndex:i,callCount:a,tx:o}=n,s=`tempo.tx.${i}`,l=String(r.to||``).trim(),u=a>1?`Transaction ${i+1} to contract`:`Transaction to contract`,d=c({rootId:s,call:r,tx:o});return{id:s,kind:`tempo.eip2718`,label:u,txTypeHex:`0x76`,txTypeName:`TempoTransaction`,to:l,selector:t(e(String(r.input||`0x`))),...d?{children:[d]}:{}}}function u(e){if(e.kind!==`tempoTransaction`)return[{id:`tempo.raw`,kind:`raw.fallback`,label:`Unsupported Tempo Payload`,raw:a(e)}];let t=Array.isArray(e.tx.calls)?e.tx.calls:[];return t.length?t.map((n,r)=>l({call:n,callIndex:r,callCount:t.length,tx:e.tx})):[{id:`tempo.raw`,kind:`raw.fallback`,label:`Tempo Payload Missing Calls`,raw:a(e)}]}function d(e){let t=u(e.request),n=BigInt(0);if(e.request.kind===`tempoTransaction`)for(let t of e.request.tx.calls||[])n+=BigInt(t.value||0);return{chain:`tempo`,chainId:e.request.kind===`tempoTransaction`?e.request.tx.chainId:void 0,intentDigest:e.intentDigest,signerAccount:e.signerAccount,title:e.title||`Tempo Transaction`,subtitle:e.subtitle,operations:t,...n>0n?{totals:{nativeValue:n.toString(),nativeSymbol:`wei`}}:{}}}export{d as t};
@@ -0,0 +1 @@
1
+ import{h as e,r as t}from"./domainIds-C3fUa33Q.js";import{J as n,q as r}from"./activeWalletSession-BtEHhe99.js";import{i,r as a}from"./base64-BmKR3UqU.js";import{t as o}from"./canonicalPrimitives-D_1HyEuJ.js";import{a as s,c,o as l,s as u}from"./ecdsaChainTarget-svSlzhze.js";import{Dt as ee,Ht as te,Jt as d,T as f,bt as p,ct as m,dn as h,et as g,i as _,ln as v,n as ne,r as re,rn as ie,t as ae,un as oe,wt as y,yt as se}from"./emailOtpEcdsaDerivationIdentity-DreNrM6n.js";function b(e,t){let n=String(e??``).trim();if(!n)throw Error(`${t} must be a non-empty string`);return n}function ce(e){return b(e,`signing-session seal key version`)}function le(e){return b(e,`ECDSA client verifying share`)}function ue(e){return b(e,`ECDSA relayer key id`)}function de(e){return b(e,`ECDSA key handle`)}function fe(e){return e}function pe(e){if(typeof e!=`string`)throw Error(`ECDSA client verifying public key must be a string`);let t=e.trim();if(!/^[A-Za-z0-9_-]+$/.test(t))throw Error(`ECDSA client verifying public key must be unpadded base64url`);let n;try{n=a(t)}catch{throw Error(`ECDSA client verifying public key must be valid base64url`)}if(n.length!==33||i(n)!==t)throw Error(`ECDSA client verifying public key must be canonical base64url for 33 bytes`);if(n[0]!==2&&n[0]!==3)throw Error(`ECDSA client verifying public key must be compressed secp256k1`);return t}function x(e){return ie(e)}function S(e){return b(e,`ECDSA role-local material handle`)}function C(e){return b(e,`ECDSA role-local binding digest`)}function w(e){return b(e,`ECDSA role-local durable material reference`)}function T(t){if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`ECDSA role-local persisted material reference must be an object`);let n=t,r=Object.keys(n).sort(),i=[`bindingDigest`,`durableMaterialRef`,`kind`,`materialActivation`];if(r.length!==i.length||r.some((e,t)=>e!==i[t]))throw Error(`ECDSA role-local persisted material reference has unexpected fields`);if(n.kind!==`ecdsa_role_local_persisted_material_ref_v1`)throw Error(`ECDSA role-local persisted material reference kind is invalid`);let a=e(n.materialActivation);if(!a.ok)throw Error(a.error.message);return{kind:`ecdsa_role_local_persisted_material_ref_v1`,durableMaterialRef:w(n.durableMaterialRef),bindingDigest:C(n.bindingDigest),materialActivation:a.value}}function E(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`ECDSA role-local worker handle must be an object`);let t=e,n=Object.keys(t).sort(),r=[`bindingDigest`,`durableMaterialRef`,`kind`,`materialHandle`];if(n.length!==r.length||n.some((e,t)=>e!==r[t]))throw Error(`ECDSA role-local worker handle has unexpected fields`);if(t.kind!==`ecdsa_role_local_worker_handle_v1`)throw Error(`ECDSA role-local worker handle kind is invalid`);return{kind:`ecdsa_role_local_worker_handle_v1`,materialHandle:S(t.materialHandle),bindingDigest:C(t.bindingDigest),durableMaterialRef:w(t.durableMaterialRef)}}function D(e){throw Error(`Unhandled ECDSA role-local branch: ${String(e)}`)}function O(e,t){if(typeof e!=`string`||!e.trim())throw Error(`[platform][ecdsa-role-local] ${t} is required`);return e.trim()}function k(e,t,n){let r=O(e,t);if(a(r).length!==n)throw Error(`[platform][ecdsa-role-local] ${t} must decode to ${n} bytes`);return r}function A(e,t){let n=O(e,t),r=a(n);if(r.length!==33)throw Error(`[platform][ecdsa-role-local] ${t} must decode to 33 bytes`);if(r[0]!==2&&r[0]!==3)throw Error(`[platform][ecdsa-role-local] ${t} must be a compressed SEC1 key`);return n}function j(e){return A(e,`derivationClientSharePublicKey33B64u`)}function M(e){return A(e,`relayerPublicKey33B64u`)}function N(e){return A(e,`groupPublicKey33B64u`)}function P(e){let t=O(e,`ethereumAddress`).toLowerCase();if(!/^0x[0-9a-f]{40}$/.test(t))throw Error(`[platform][ecdsa-role-local] ethereumAddress must be an EVM address`);return t}function F(e){if(!Array.isArray(e)||e.length!==2||e[0]!==1||e[1]!==2)throw Error(`[platform][ecdsa-role-local] participantIds must be [1, 2]`);return[1,2]}function I(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`[platform][ecdsa-role-local] stateBlob must be an object`);if(Object.keys(e).sort().join(`,`)!==`curve,encoding,kind,producer,stateBlobB64u`)throw Error(`[platform][ecdsa-role-local] stateBlob envelope is invalid`);let t=O(Reflect.get(e,`kind`),`stateBlob.kind`),n=O(Reflect.get(e,`curve`),`stateBlob.curve`),r=O(Reflect.get(e,`encoding`),`stateBlob.encoding`),i=O(Reflect.get(e,`producer`),`stateBlob.producer`),o=O(Reflect.get(e,`stateBlobB64u`),`stateBlob.stateBlobB64u`);if(t!==`ecdsa_role_local_state_blob_v1`||n!==`secp256k1`||r!==`base64url`||i!==`signer_core`)throw Error(`[platform][ecdsa-role-local] stateBlob envelope is invalid`);try{a(o)}catch(e){throw Error(`[platform][ecdsa-role-local] stateBlob payload is not base64url`,{cause:e})}return{kind:`ecdsa_role_local_state_blob_v1`,curve:`secp256k1`,encoding:`base64url`,producer:`signer_core`,stateBlobB64u:o}}function L(e,t=`credentialIdB64u`){return O(e,t)}function R(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`[platform][ecdsa-role-local] authMethod must be an object`);switch(O(Reflect.get(e,`kind`),`authMethod.kind`)){case`passkey`:if(Object.keys(e).sort().join(`,`)!==`credentialIdB64u,kind,rpId`)throw Error(`[platform][ecdsa-role-local] passkey authMethod fields are invalid`);return{kind:`passkey`,credentialIdB64u:L(Reflect.get(e,`credentialIdB64u`)),rpId:f(Reflect.get(e,`rpId`))};case`email_otp`:if(Object.keys(e).sort().join(`,`)!==`authSubjectId,kind`)throw Error(`[platform][ecdsa-role-local] email OTP authMethod fields are invalid`);return{kind:`email_otp`,authSubjectId:_(Reflect.get(e,`authSubjectId`))};default:throw Error(`[platform][ecdsa-role-local] authMethod kind is invalid`)}}function z(e){return{kind:`passkey`,credentialIdB64u:L(e.credentialIdB64u),rpId:f(e.rpId)}}function B(e){return{kind:`email_otp`,authSubjectId:_(e.authSubjectId)}}function me(e,t){if(e.kind!==t.kind)return!1;switch(e.kind){case`passkey`:return t.kind===`passkey`?String(e.rpId)===String(t.rpId)&&String(e.credentialIdB64u)===String(t.credentialIdB64u):!1;case`email_otp`:return t.kind===`email_otp`?String(e.authSubjectId)===String(t.authSubjectId):!1;default:return D(e)}}function he(e){switch(e.authMethod.kind){case`passkey`:return{kind:`ecdsa_role_local_ready_passkey_v1`,stateBlob:e.stateBlob,publicFacts:e.publicFacts,authMethod:e.authMethod};case`email_otp`:return{kind:`ecdsa_role_local_ready_email_otp_v1`,stateBlob:e.stateBlob,publicFacts:e.publicFacts,authMethod:e.authMethod};default:return D(e.authMethod)}}function ge(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`[platform][ecdsa-role-local] chainTarget must be an object`);switch(O(Reflect.get(e,`kind`),`chainTarget.kind`).toLowerCase()){case`evm`:if(Object.keys(e).sort().join(`,`)!==`chainId,kind,namespace,networkSlug`)throw Error(`[platform][ecdsa-role-local] EVM chainTarget fields are invalid`);return s({kind:Reflect.get(e,`kind`),namespace:Reflect.get(e,`namespace`),chainId:Reflect.get(e,`chainId`),networkSlug:Reflect.get(e,`networkSlug`)});case`tempo`:if(Object.keys(e).sort().join(`,`)!==`chainId,kind,networkSlug`)throw Error(`[platform][ecdsa-role-local] Tempo chainTarget fields are invalid`);return s({kind:Reflect.get(e,`kind`),chainId:Reflect.get(e,`chainId`),networkSlug:Reflect.get(e,`networkSlug`)});default:throw Error(`[platform][ecdsa-role-local] chainTarget kind is invalid`)}}function V(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`[platform][ecdsa-role-local] publicFacts must be an object`);if(Object.keys(e).sort().join(`,`)!==`applicationBindingDigestB64u,chainTarget,clientParticipantId,contextBinding32B64u,derivationClientSharePublicKey33B64u,ecdsaThresholdKeyId,ethereumAddress,groupPublicKey33B64u,keyHandle,participantIds,publicCapability,relayerParticipantId,relayerPublicKey33B64u,signingRootId,signingRootVersion,walletId`)throw Error(`[platform][ecdsa-role-local] publicFacts fields are invalid`);if(Reflect.get(e,`clientParticipantId`)!==1)throw Error(`[platform][ecdsa-role-local] clientParticipantId must be 1`);if(Reflect.get(e,`relayerParticipantId`)!==2)throw Error(`[platform][ecdsa-role-local] relayerParticipantId must be 2`);let t=j(Reflect.get(e,`derivationClientSharePublicKey33B64u`)),n=M(Reflect.get(e,`relayerPublicKey33B64u`));if(String(t)===String(n))throw Error(`[platform][ecdsa-role-local] relayerPublicKey33B64u must differ from derivationClientSharePublicKey33B64u`);return{walletId:c(Reflect.get(e,`walletId`)),chainTarget:ge(Reflect.get(e,`chainTarget`)),keyHandle:O(Reflect.get(e,`keyHandle`),`keyHandle`),ecdsaThresholdKeyId:re(Reflect.get(e,`ecdsaThresholdKeyId`)),signingRootId:ae(Reflect.get(e,`signingRootId`)),signingRootVersion:ne(Reflect.get(e,`signingRootVersion`)),applicationBindingDigestB64u:k(Reflect.get(e,`applicationBindingDigestB64u`),`applicationBindingDigestB64u`,32),clientParticipantId:1,relayerParticipantId:2,participantIds:F(Reflect.get(e,`participantIds`)),contextBinding32B64u:k(Reflect.get(e,`contextBinding32B64u`),`contextBinding32B64u`,32),derivationClientSharePublicKey33B64u:t,relayerPublicKey33B64u:n,groupPublicKey33B64u:N(Reflect.get(e,`groupPublicKey33B64u`)),ethereumAddress:P(Reflect.get(e,`ethereumAddress`)),publicCapability:g(Reflect.get(e,`publicCapability`))}}function H(e){return V(e)}function _e(e){let t=e.publicFacts;return H({walletId:t.walletId,chainTarget:e.chainTarget,keyHandle:t.keyHandle,ecdsaThresholdKeyId:t.ecdsaThresholdKeyId,signingRootId:t.signingRootId,signingRootVersion:t.signingRootVersion,applicationBindingDigestB64u:t.applicationBindingDigestB64u,clientParticipantId:t.clientParticipantId,relayerParticipantId:t.relayerParticipantId,participantIds:t.participantIds,contextBinding32B64u:t.contextBinding32B64u,derivationClientSharePublicKey33B64u:t.derivationClientSharePublicKey33B64u,relayerPublicKey33B64u:t.relayerPublicKey33B64u,groupPublicKey33B64u:t.groupPublicKey33B64u,ethereumAddress:t.ethereumAddress,publicCapability:t.publicCapability})}function U(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`[platform][ecdsa-role-local] ready record must be an object`);if(Object.keys(e).sort().join(`,`)!==`authMethod,kind,publicFacts,stateBlob`)throw Error(`[platform][ecdsa-role-local] ready record fields are invalid`);let t=O(Reflect.get(e,`kind`),`readyRecord.kind`);if(t!==`ecdsa_role_local_ready_passkey_v1`&&t!==`ecdsa_role_local_ready_email_otp_v1`)throw Error(`[platform][ecdsa-role-local] ready record kind is invalid`);let n=V(Reflect.get(e,`publicFacts`)),r=he({stateBlob:I(Reflect.get(e,`stateBlob`)),publicFacts:n,authMethod:R(Reflect.get(e,`authMethod`))});if(t===`ecdsa_role_local_ready_passkey_v1`&&r.kind!==t||t===`ecdsa_role_local_ready_email_otp_v1`&&r.kind!==t)throw Error(`[platform][ecdsa-role-local] ready record authMethod branch mismatch`);return r}function ve(e){switch(e.kind){case`passkey`:return{kind:`passkey`,credentialIdB64u:e.credentialIdB64u,rpId:e.rpId};case`email_otp`:return{kind:`email_otp`,authSubjectId:e.authSubjectId};default:return D(e)}}function ye(e){return{walletId:e.walletId,chainTarget:e.chainTarget,keyHandle:e.keyHandle,ecdsaThresholdKeyId:e.ecdsaThresholdKeyId,signingRootId:e.signingRootId,signingRootVersion:e.signingRootVersion,applicationBindingDigestB64u:e.applicationBindingDigestB64u,clientParticipantId:1,relayerParticipantId:2,participantIds:[1,2],contextBinding32B64u:e.contextBinding32B64u,derivationClientSharePublicKey33B64u:e.derivationClientSharePublicKey33B64u,relayerPublicKey33B64u:e.relayerPublicKey33B64u,groupPublicKey33B64u:e.groupPublicKey33B64u,ethereumAddress:e.ethereumAddress,publicCapability:e.publicCapability}}function be(e){let t=U(e);return{kind:t.kind,stateBlob:{kind:t.stateBlob.kind,curve:t.stateBlob.curve,encoding:t.stateBlob.encoding,producer:t.stateBlob.producer,stateBlobB64u:t.stateBlob.stateBlobB64u},publicFacts:ye(t.publicFacts),authMethod:ve(t.authMethod)}}function W(e){return encodeURIComponent(O(e,`storage key part`))}function xe(e){return[`ecdsa_role_local_ready_v1`,W(e.walletId),W(l(e.chainTarget)),W(e.keyHandle),W(e.ecdsaThresholdKeyId),W(e.signingRootId),W(e.signingRootVersion),W(e.participantIds.join(`,`)),W(Ce(e.authMethod))].join(`:`)}function Se(e){let t=U(e),n=t.publicFacts;return{walletId:n.walletId,chainTarget:n.chainTarget,keyHandle:n.keyHandle,ecdsaThresholdKeyId:n.ecdsaThresholdKeyId,signingRootId:n.signingRootId,signingRootVersion:n.signingRootVersion,participantIds:n.participantIds,authMethod:t.authMethod}}function Ce(e){switch(e.kind){case`passkey`:return[`passkey`,e.rpId,e.credentialIdB64u].join(`:`);case`email_otp`:return[`email_otp`,e.authSubjectId].join(`:`);default:return D(e)}}function we(e){let t=e.record.publicFacts,n=e.input;return String(t.walletId)===String(n.walletId)&&u(t.chainTarget,n.chainTarget)&&String(t.keyHandle)===String(n.keyHandle)&&String(t.ecdsaThresholdKeyId)===String(n.ecdsaThresholdKeyId)&&String(t.signingRootId)===String(n.signingRootId)&&String(t.signingRootVersion)===String(n.signingRootVersion)&&t.participantIds[0]===n.participantIds[0]&&t.participantIds[1]===n.participantIds[1]&&me(e.record.authMethod,n.authMethod)}var G=class{retainProof(){return!0}constructor(){this.retainProof()}},Te=class extends G{kind=`evm_family`;targetMemberships;constructor(e){super(),this.targetMemberships=e}},Ee=class extends G{manifestId;manifestRevision;constructor(e){super(),this.manifestId=e.manifestId,this.manifestRevision=e.manifestRevision}},De=class extends G{kind=`no_current_manifest`},Oe=class extends G{kind=`exact_manifest`;manifestId;manifestRevision;constructor(e){super(),this.manifestId=e.manifestId,this.manifestRevision=e.manifestRevision}},ke=class extends G{kind=`no_current_generation`},Ae=class extends G{kind=`exact_generation`;serverGeneration;constructor(e){super(),this.serverGeneration=e}},je=class extends G{kind=`ecdsa_role_local_material_binding`;keyHandle;ecdsaThresholdKeyId;clientVerifyingPublicKey33B64u;participantIds;relayerKeyId;constructor(e){super(),this.keyHandle=e.keyHandle,this.ecdsaThresholdKeyId=e.ecdsaThresholdKeyId,this.clientVerifyingPublicKey33B64u=e.clientVerifyingPublicKey33B64u,this.participantIds=e.participantIds,this.relayerKeyId=e.relayerKeyId}},Me=class extends G{kind=`prepared_evm_family_signer`;capability;signerId;walletId;authority;scope;materialOwner;signingRootId;signingRootVersion;constructor(e){super(),this.capability=e.capability,this.signerId=e.signerId,this.walletId=e.authority.walletId,this.authority=e.authority,this.scope=e.scope,this.materialOwner=e.materialOwner,this.signingRootId=e.signingRootId,this.signingRootVersion=e.signingRootVersion}},Ne=class extends G{kind=`registered_evm_family_signer`;capability;signerId;walletId;authority;scope;materialOwner;signingRootId;signingRootVersion;registeredPublicFacts;constructor(e){super(),this.capability=e.preparedSigner.capability,this.signerId=e.preparedSigner.signerId,this.walletId=e.preparedSigner.walletId,this.authority=e.preparedSigner.authority,this.scope=e.preparedSigner.scope,this.materialOwner=e.preparedSigner.materialOwner,this.signingRootId=e.preparedSigner.signingRootId,this.signingRootVersion=e.preparedSigner.signingRootVersion,this.registeredPublicFacts=e.registeredPublicFacts}},Pe=class extends G{kind=`encrypted_ecdsa_pending_candidate`;sealingKeyId;iv12B64u;ciphertextB64u;ciphertextDigest;constructor(e){super(),this.sealingKeyId=e.sealingKeyId,this.iv12B64u=e.iv12B64u,this.ciphertextB64u=e.ciphertextB64u,this.ciphertextDigest=e.ciphertextDigest}},Fe=class extends G{kind=`ecdsa_activation_binding`;targetManifest;signer;roleLocalBinding;bindingDigest;durableMaterialRef;constructor(e){super(),this.targetManifest=e.targetManifest,this.signer=e.signer,this.roleLocalBinding=e.roleLocalBinding,this.bindingDigest=e.bindingDigest,this.durableMaterialRef=e.durableMaterialRef}},Ie=class extends G{kind=`prepared_ecdsa_activation_candidate`;activationBinding;encryptedPending;constructor(e){super(),this.activationBinding=e.activationBinding,this.encryptedPending=e.encryptedPending}},Le=class extends G{kind=`ecdsa_server_activation_command`;correlationId;expectedGeneration;requestDigest;canonicalRequest;constructor(e){super(),this.correlationId=e.correlationId,this.expectedGeneration=e.expectedGeneration,this.requestDigest=e.requestDigest,this.canonicalRequest=e.canonicalRequest}},Re=class extends G{kind=`ecdsa_server_activation_receipt`;lifecycleId;activationDigest;activatedAt;protocolReceipt;constructor(e){super(),this.lifecycleId=e.lifecycleId,this.activationDigest=e.activationDigest,this.activatedAt=e.activatedAt,this.protocolReceipt=e.protocolReceipt}},ze=class extends G{kind=`ecdsa_server_activation_commit`;correlationId;activationRequestDigest;serverGeneration;serverActivationReceipt;constructor(e){super(),this.correlationId=e.correlationId,this.activationRequestDigest=e.activationRequestDigest,this.serverGeneration=e.serverGeneration,this.serverActivationReceipt=e.serverActivationReceipt}},Be=class extends G{kind=`activation_prepared`;journalId;expectedManifest;activationCommand;candidate;createdAt;constructor(e){super(),this.journalId=e.journalId,this.expectedManifest=e.expectedManifest,this.activationCommand=e.activationCommand,this.candidate=e.candidate,this.createdAt=e.createdAt}},Ve=class extends G{kind=`server_activation_committed`;journalId;expectedManifest;activationCommand;candidate;createdAt;serverActivation;constructor(e){super(),this.journalId=e.journalId,this.expectedManifest=e.expectedManifest,this.activationCommand=e.activationCommand,this.candidate=e.candidate,this.createdAt=e.createdAt,this.serverActivation=e.serverActivation}},He=class extends G{kind=`durable_ecdsa_material`;materialActivation;routerAbEcdsaDerivationNormalSigning;roleLocalPublicFacts;roleLocalBinding;durableMaterialRef;bindingDigest;lifecycleId;ciphertextDigest;activationDigest;activatedAt;runtimePolicyScope;constructor(e){super(),this.materialActivation=e.materialActivation,this.routerAbEcdsaDerivationNormalSigning=e.routerAbEcdsaDerivationNormalSigning,this.roleLocalPublicFacts=e.roleLocalPublicFacts,this.roleLocalBinding=e.roleLocalBinding,this.durableMaterialRef=e.durableMaterialRef,this.bindingDigest=e.bindingDigest,this.lifecycleId=e.lifecycleId,this.ciphertextDigest=e.ciphertextDigest,this.activationDigest=e.activationDigest,this.activatedAt=e.activatedAt,this.runtimePolicyScope=e.runtimePolicyScope}},Ue=class extends G{kind=`encrypted_ecdsa_ready_material`;binding;sealingKeyId;iv12B64u;ciphertextB64u;constructor(e){super(),this.binding=e.binding,this.sealingKeyId=e.sealingKeyId,this.iv12B64u=e.iv12B64u,this.ciphertextB64u=e.ciphertextB64u}},We=class extends G{kind=`active_ecdsa_capability_manifest`;identity;signer;activation;durableMaterial;committedAt;constructor(e){super(),this.identity=e.identity,this.signer=e.signer,this.activation=e.activation,this.durableMaterial=e.durableMaterial,this.committedAt=e.committedAt}},Ge=class extends G{kind=`replaced_ecdsa_capability_manifest`;identity;signer;retirement;constructor(e){super(),this.identity=e.identity,this.signer=e.signer,this.retirement=e.retirement}};function Ke(e){if(!e.ok)throw Error(e.error.message);return e.value}function qe(e){return ut(e.targetMemberships),new Te([...e.targetMemberships])}function Je(e){return new Ee(e)}function Ye(){return new De}function Xe(e){return new Oe(e)}function Ze(){return new ke}function Qe(e){return new Ae(e)}function $e(e){return dt(e.participantIds),new je({keyHandle:e.keyHandle,ecdsaThresholdKeyId:e.ecdsaThresholdKeyId,clientVerifyingPublicKey33B64u:e.clientVerifyingPublicKey33B64u,participantIds:[...e.participantIds],relayerKeyId:e.relayerKeyId})}function et(e){return new Me(e)}function tt(e){return new Pe(e)}function nt(e){return new Fe(e)}function rt(e){return new Ie(e)}function it(e){ft(e.expectedManifest,e.candidate.activationBinding.targetManifest),pt(e.expectedManifest,e.expectedGeneration);let t=new Le({correlationId:e.journalId,expectedGeneration:e.expectedGeneration,requestDigest:e.requestDigest,canonicalRequest:e.canonicalRequest});return new Be({journalId:e.journalId,expectedManifest:e.expectedManifest,activationCommand:t,candidate:e.candidate,createdAt:e.createdAt})}function K(e){let t=m(e.serverCommit.protocolReceipt);ht(t,e.serverCommit),J(t,e.activationBinding);let n=new Re({lifecycleId:gt(t),activationDigest:_t(t),activatedAt:o(t.ecdsa_activation.activated_at_ms),protocolReceipt:t});return new ze({correlationId:e.serverCommit.correlationId,activationRequestDigest:e.serverCommit.activationRequestDigest,serverGeneration:e.serverCommit.serverGeneration,serverActivationReceipt:n})}function at(e){mt(e.serverCommit,e.preparedJournal);let t=K({activationBinding:e.preparedJournal.candidate.activationBinding,serverCommit:e.serverCommit});return new Ve({journalId:e.preparedJournal.journalId,expectedManifest:e.preparedJournal.expectedManifest,activationCommand:e.preparedJournal.activationCommand,candidate:e.preparedJournal.candidate,createdAt:e.preparedJournal.createdAt,serverActivation:t})}function ot(e){yt(e.serverActivation,e.activationBinding);let t=e.roleLocalPublicFacts,i=e.activationBinding,a=n(e.runtimePolicyScope);if(t.walletId!==i.signer.walletId||t.keyHandle!==i.roleLocalBinding.keyHandle||t.ecdsaThresholdKeyId!==i.roleLocalBinding.ecdsaThresholdKeyId||t.signingRootId!==i.signer.signingRootId||t.signingRootVersion!==i.signer.signingRootVersion||r(a)!==i.signer.signingRootId||a.signingRootVersion!==i.signer.signingRootVersion||t.contextBinding32B64u!==i.bindingDigest||!X(t.participantIds,i.roleLocalBinding.participantIds)||!i.signer.scope.targetMemberships.some(e=>q(e)===q(t.chainTarget)))throw Error(`ECDSA role-local public facts do not match their activation`);let o=e.serverActivation.serverActivationReceipt;return Q({normalSigning:e.routerAbEcdsaDerivationNormalSigning,activationBinding:i,roleLocalPublicFacts:t,receipt:o.protocolReceipt}),new He({materialActivation:Y(o.protocolReceipt),routerAbEcdsaDerivationNormalSigning:e.routerAbEcdsaDerivationNormalSigning,roleLocalPublicFacts:e.roleLocalPublicFacts,roleLocalBinding:e.activationBinding.roleLocalBinding,durableMaterialRef:e.activationBinding.durableMaterialRef,bindingDigest:e.activationBinding.bindingDigest,lifecycleId:o.lifecycleId,ciphertextDigest:e.ciphertextDigest,activationDigest:o.activationDigest,activatedAt:o.activatedAt,runtimePolicyScope:a})}function st(e){return new Ue({binding:e.binding,sealingKeyId:e.sealingKeyId,iv12B64u:e.iv12B64u,ciphertextB64u:e.ciphertextB64u})}function ct(e){vt(e.registeredPublicFacts,e.activationBinding.roleLocalBinding,e.serverActivation),bt(e.durableMaterial,e.activationBinding,e.serverActivation);let t=new Ne({preparedSigner:e.activationBinding.signer,registeredPublicFacts:e.registeredPublicFacts}),n={kind:`active_ecdsa_material_activation`,materialActivation:e.durableMaterial.materialActivation,serverActivation:e.serverActivation,retention:`retained`};return new We({identity:e.activationBinding.targetManifest,signer:t,activation:n,durableMaterial:e.durableMaterial,committedAt:e.committedAt})}function lt(e){return xt(e.activeManifest,e.replacementManifest),new Ge({identity:e.activeManifest.identity,signer:e.activeManifest.signer,retirement:{kind:`replaced`,replacementManifest:e.replacementManifest.identity,replacementActivation:e.replacementManifest.activation.serverActivation}})}function ut(e){let t=e.map(q);if(new Set(t).size!==t.length)throw Error(`ECDSA capability target memberships must be unique`)}function q(e){switch(e.kind){case`evm`:return`evm:${e.namespace}:${e.chainId}:${e.networkSlug}`;case`tempo`:return`tempo:${e.chainId}:${e.networkSlug}`;default:return $(e)}}function dt(e){let t=e.map(Number);if(t.some(e=>!Number.isSafeInteger(e)||e<1)||new Set(t).size!==t.length)throw Error(`ECDSA participant ids must be unique positive integers`)}function ft(e,t){switch(e.kind){case`no_current_manifest`:if(Number(t.manifestRevision)!==1)throw Error(`Initial ECDSA manifest revision must be 1`);return;case`exact_manifest`:if(t.manifestId===e.manifestId||Number(t.manifestRevision)!==Number(e.manifestRevision)+1)throw Error(`Replacement ECDSA manifest must use a fresh id and next revision`);return;default:return $(e)}}function pt(e,t){switch(e.kind){case`no_current_manifest`:if(t.kind!==`no_current_generation`)throw Error(`Initial ECDSA activation cannot expect a server generation`);return;case`exact_manifest`:if(t.kind!==`exact_generation`)throw Error(`Replacement ECDSA activation requires an exact server generation`);return;default:return $(e)}}function mt(e,t){let n=JSON.parse(t.activationCommand.canonicalRequest).operation===`wallet_registration_activate_v2`;if(e.correlationId!==t.activationCommand.correlationId||!n&&e.activationRequestDigest!==t.activationCommand.requestDigest)throw Error(`ECDSA server activation commit does not match the prepared command`)}function J(e,t){let n=e.ecdsa_activation.public_identity,r=e.ecdsa_activation.material_activation;if(Y(e),n.context_binding_b64u!==String(t.bindingDigest)||n.derivation_client_share_public_key33_b64u!==String(t.roleLocalBinding.clientVerifyingPublicKey33B64u)||r.material_owner!==String(t.signer.materialOwner)||r.key_binding!==String(t.bindingDigest)||r.lifecycle_binding!==e.lifecycle_id||r.signing_worker!==e.ecdsa_activation.signing_worker.server_id)throw Error(`ECDSA activation receipt does not match the prepared material binding`)}function ht(e,t){let n=i(Uint8Array.from(e.activation_request_digest.bytes));if(e.activation_correlation_id!==t.correlationId||n!==t.activationRequestDigest||e.server_generation!==t.serverGeneration)throw Error(`ECDSA activation receipt does not match the server activation commit`)}function gt(e){return d(e.lifecycle_id)}function _t(e){return te(e.ecdsa_activation.activation_digest_b64u)}function Y(e){return v(e.ecdsa_activation.material_activation)}function vt(e,t,n){let r=n.serverActivationReceipt.protocolReceipt.ecdsa_activation.public_identity;if(String(e.keyHandle)!==String(t.keyHandle)||String(e.publicKeyB64u)!==r.threshold_public_key33_b64u||String(t.clientVerifyingPublicKey33B64u)!==r.derivation_client_share_public_key33_b64u||!X(e.participantIds,t.participantIds))throw Error(`Registered ECDSA public facts do not match role-local material`)}function X(e,t){return e.length===t.length?e.every((e,n)=>Number(e)===Number(t[n])):!1}function yt(e,t){J(e.serverActivationReceipt.protocolReceipt,t)}function bt(e,n,r){let i=r.serverActivationReceipt,a=Y(i.protocolReceipt);if(!t(e.materialActivation,a)||e.roleLocalBinding!==n.roleLocalBinding||e.durableMaterialRef!==n.durableMaterialRef||e.bindingDigest!==n.bindingDigest||e.lifecycleId!==i.lifecycleId||e.activationDigest!==i.activationDigest||e.activatedAt!==i.activatedAt)throw Error(`Durable ECDSA material does not match its activation`);Q({normalSigning:e.routerAbEcdsaDerivationNormalSigning,activationBinding:n,roleLocalPublicFacts:e.roleLocalPublicFacts,receipt:i.protocolReceipt})}function Z(e,t){return e.kind===t.kind&&e.context.application_binding_digest_b64u===t.context.application_binding_digest_b64u&&y(e.public_identity,t.public_identity)&&h(e.material_activation,t.material_activation)&&p(e.signer_set,t.signer_set)&&se(e.deriver_recipient_keys,t.deriver_recipient_keys)&&e.router_id===t.router_id&&e.client_id===t.client_id&&e.activation_epoch===t.activation_epoch&&e.registration_request_digest_b64u===t.registration_request_digest_b64u&&e.proof_transcript_digest_b64u===t.proof_transcript_digest_b64u}function Q(e){let t=e.normalSigning.scope,n=e.roleLocalPublicFacts,r=Y(e.receipt),i=oe({kind:r.kind,activationId:r.activationId,capability:r.capability,materialOwner:r.materialOwner,keyBinding:r.keyBinding,lifecycleBinding:r.lifecycleBinding,signingWorker:r.signingWorker});if(t.wallet_id!==String(e.activationBinding.signer.walletId)||t.ecdsa_threshold_key_id!==String(e.activationBinding.roleLocalBinding.ecdsaThresholdKeyId)||t.signing_root_id!==String(e.activationBinding.signer.signingRootId)||t.signing_root_version!==String(e.activationBinding.signer.signingRootVersion)||t.context.application_binding_digest_b64u!==e.receipt.ecdsa_activation.context.application_binding_digest_b64u||!y(t.public_identity,e.receipt.ecdsa_activation.public_identity)||!ee(t.signing_worker,e.receipt.ecdsa_activation.signing_worker)||t.activation_epoch!==e.receipt.ecdsa_activation.activation_epoch||t.public_identity.context_binding_b64u!==n.contextBinding32B64u||t.public_identity.derivation_client_share_public_key33_b64u!==n.derivationClientSharePublicKey33B64u||t.public_identity.server_public_key33_b64u!==n.relayerPublicKey33B64u||t.public_identity.threshold_public_key33_b64u!==n.groupPublicKey33B64u||!h(t.material_activation,i))throw Error(`ECDSA normal-signing runtime does not match its activation`)}function xt(e,t){if(e.identity.manifestId===t.identity.manifestId||Number(t.identity.manifestRevision)!==Number(e.identity.manifestRevision)+1||e.signer.capability!==t.signer.capability||e.signer.signerId!==t.signer.signerId||e.signer.walletId!==t.signer.walletId||e.signer.authority.authorityDigest!==t.signer.authority.authorityDigest||e.signer.materialOwner!==t.signer.materialOwner||e.durableMaterial.durableMaterialRef===t.durableMaterial.durableMaterialRef||e.activation.serverActivation.serverGeneration===t.activation.serverActivation.serverGeneration)throw Error(`ECDSA replacement manifest does not exactly replace the active manifest`)}function $(e){throw Error(`Unexpected ECDSA capability branch: ${String(e)}`)}export{pe as A,ue as B,H as C,U as D,Se as E,E as F,x as I,fe as L,w as M,S as N,_e as O,T as P,le as R,z as S,xe as T,ce as V,at as _,Je as a,Ke as b,tt as c,Ye as d,Ze as f,lt as g,et as h,qe as i,C as j,be as k,Xe as l,it as m,ot as n,$e as o,rt as p,nt as r,K as s,ct as t,Qe as u,st as v,we as w,B as x,Z as y,de as z};