@cedros/login-react 0.0.11 → 0.0.13
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.
- package/README.md +68 -0
- package/dist/AdminDepositList-Cx0xRwES.js +305 -0
- package/dist/AdminDepositList-Cx0xRwES.js.map +1 -0
- package/dist/AdminDepositList-UEcyRZkA.cjs +1 -0
- package/dist/AdminDepositList-UEcyRZkA.cjs.map +1 -0
- package/dist/AdminUserDetail-BzEIdNJh.cjs +1 -0
- package/dist/AdminUserDetail-BzEIdNJh.cjs.map +1 -0
- package/dist/AdminUserDetail-DHFDzY8B.js +1195 -0
- package/dist/AdminUserDetail-DHFDzY8B.js.map +1 -0
- package/dist/AdminWithdrawalHistory-0yxtMh6q.cjs +1 -0
- package/dist/AdminWithdrawalHistory-0yxtMh6q.cjs.map +1 -0
- package/dist/AdminWithdrawalHistory-BGjfrIe3.js +904 -0
- package/dist/AdminWithdrawalHistory-BGjfrIe3.js.map +1 -0
- package/dist/AuthenticationSettings-5Vi7Ib_A.cjs +1 -0
- package/dist/AuthenticationSettings-5Vi7Ib_A.cjs.map +1 -0
- package/dist/AuthenticationSettings-BPAh1my6.cjs +1 -0
- package/dist/AuthenticationSettings-BPAh1my6.cjs.map +1 -0
- package/dist/AuthenticationSettings-CJg8CJY9.js +9 -0
- package/dist/AuthenticationSettings-CJg8CJY9.js.map +1 -0
- package/dist/AuthenticationSettings-CR_i6TTS.js +495 -0
- package/dist/AuthenticationSettings-CR_i6TTS.js.map +1 -0
- package/dist/AutosaveStatus-CYkC2aI_.cjs +1 -0
- package/dist/AutosaveStatus-CYkC2aI_.cjs.map +1 -0
- package/dist/AutosaveStatus-N4uNS6-2.js +1497 -0
- package/dist/AutosaveStatus-N4uNS6-2.js.map +1 -0
- package/dist/CreditSystemSettings-BnAOK_tT.cjs +1 -0
- package/dist/CreditSystemSettings-BnAOK_tT.cjs.map +1 -0
- package/dist/CreditSystemSettings-CIf_SfJq.js +210 -0
- package/dist/CreditSystemSettings-CIf_SfJq.js.map +1 -0
- package/dist/CreditSystemSettings-CePYGgev.js +9 -0
- package/dist/CreditSystemSettings-CePYGgev.js.map +1 -0
- package/dist/CreditSystemSettings-Ck5WIMp3.cjs +1 -0
- package/dist/CreditSystemSettings-Ck5WIMp3.cjs.map +1 -0
- package/dist/{DepositsSection-BH5K162Q.js → DepositsSection-DA89uR9A.js} +5 -5
- package/dist/{DepositsSection-BH5K162Q.js.map → DepositsSection-DA89uR9A.js.map} +1 -1
- package/dist/DepositsSection-i6XdhLNs.cjs +1 -0
- package/dist/{DepositsSection-DpRn0koq.cjs.map → DepositsSection-i6XdhLNs.cjs.map} +1 -1
- package/dist/EmailRegisterForm-BrDL3BZy.js +927 -0
- package/dist/EmailRegisterForm-BrDL3BZy.js.map +1 -0
- package/dist/EmailRegisterForm-CxktR-4J.cjs +1 -0
- package/dist/EmailRegisterForm-CxktR-4J.cjs.map +1 -0
- package/dist/EmailSettings-B8xwgd6_.cjs +1 -0
- package/dist/EmailSettings-B8xwgd6_.cjs.map +1 -0
- package/dist/{AuthenticationSettings-DlVILxY4.js → EmailSettings-Bna7Z53E.js} +3 -3
- package/dist/EmailSettings-Bna7Z53E.js.map +1 -0
- package/dist/EmailSettings-DZywTTRq.cjs +1 -0
- package/dist/EmailSettings-DZywTTRq.cjs.map +1 -0
- package/dist/EmailSettings-DbMDfVaM.js +17 -0
- package/dist/EmailSettings-DbMDfVaM.js.map +1 -0
- package/dist/{EmbeddedWalletSettings-Bff6raAT.js → EmbeddedWalletSettings-ANbhj3Lt.js} +3 -3
- package/dist/EmbeddedWalletSettings-ANbhj3Lt.js.map +1 -0
- package/dist/EmbeddedWalletSettings-BEztqO19.js +79 -0
- package/dist/EmbeddedWalletSettings-BEztqO19.js.map +1 -0
- package/dist/EmbeddedWalletSettings-D6M7pwgk.cjs +1 -0
- package/dist/EmbeddedWalletSettings-D6M7pwgk.cjs.map +1 -0
- package/dist/EmbeddedWalletSettings-DivEPn39.cjs +1 -0
- package/dist/EmbeddedWalletSettings-DivEPn39.cjs.map +1 -0
- package/dist/ErrorMessage-CHbYbVi2.cjs +1 -0
- package/dist/ErrorMessage-CHbYbVi2.cjs.map +1 -0
- package/dist/ErrorMessage-CcEK0pYO.js +64 -0
- package/dist/ErrorMessage-CcEK0pYO.js.map +1 -0
- package/dist/{GoogleLoginButton-BzHr545L.js → GoogleLoginButton-B3uRMJ_n.js} +4 -3
- package/dist/{GoogleLoginButton-BzHr545L.js.map → GoogleLoginButton-B3uRMJ_n.js.map} +1 -1
- package/dist/GoogleLoginButton-BydKswn4.cjs +1 -0
- package/dist/{GoogleLoginButton-DoAdOqb3.cjs.map → GoogleLoginButton-BydKswn4.cjs.map} +1 -1
- package/dist/LoadingSpinner-6vml-zwr.js +79 -0
- package/dist/LoadingSpinner-6vml-zwr.js.map +1 -0
- package/dist/LoadingSpinner-d6sSxgQN.cjs +1 -0
- package/dist/LoadingSpinner-d6sSxgQN.cjs.map +1 -0
- package/dist/PermissionsSection-BGaj_sI7.js +1026 -0
- package/dist/PermissionsSection-BGaj_sI7.js.map +1 -0
- package/dist/PermissionsSection-CKXXDfqi.cjs +1 -0
- package/dist/PermissionsSection-CKXXDfqi.cjs.map +1 -0
- package/dist/ServerSettings-B2RKhJtZ.js +84 -0
- package/dist/ServerSettings-B2RKhJtZ.js.map +1 -0
- package/dist/ServerSettings-BZXlm1BX.cjs +1 -0
- package/dist/ServerSettings-BZXlm1BX.cjs.map +1 -0
- package/dist/{ServerSettings-UIVR0R4l.js → ServerSettings-Bqm4-bt2.js} +3 -3
- package/dist/ServerSettings-Bqm4-bt2.js.map +1 -0
- package/dist/ServerSettings-DZUKo6By.cjs +1 -0
- package/dist/ServerSettings-DZUKo6By.cjs.map +1 -0
- package/dist/SettingsPageLayout-COSYLMu7.cjs +1 -0
- package/dist/SettingsPageLayout-COSYLMu7.cjs.map +1 -0
- package/dist/SettingsPageLayout-DpgNEkuu.js +50 -0
- package/dist/SettingsPageLayout-DpgNEkuu.js.map +1 -0
- package/dist/{SolanaLoginButton-C-CfZxAZ.js → SolanaLoginButton-C_u9OppS.js} +5 -4
- package/dist/{SolanaLoginButton-C-CfZxAZ.js.map → SolanaLoginButton-C_u9OppS.js.map} +1 -1
- package/dist/SolanaLoginButton-fAW7kRUu.cjs +1 -0
- package/dist/{SolanaLoginButton-CPzms0kf.cjs.map → SolanaLoginButton-fAW7kRUu.cjs.map} +1 -1
- package/dist/StatsBar-BX-hHtTq.js +66 -0
- package/dist/StatsBar-BX-hHtTq.js.map +1 -0
- package/dist/StatsBar-DTUZCwDD.cjs +1 -0
- package/dist/StatsBar-DTUZCwDD.cjs.map +1 -0
- package/dist/{TeamSection-DnJudC38.js → TeamSection-CvrCoa9D.js} +27 -26
- package/dist/TeamSection-CvrCoa9D.js.map +1 -0
- package/dist/TeamSection-DlUD5kp5.cjs +1 -0
- package/dist/TeamSection-DlUD5kp5.cjs.map +1 -0
- package/dist/UsersSection-C2U8Tb7V.cjs +1 -0
- package/dist/{UsersSection-Ce7xVKfp.cjs.map → UsersSection-C2U8Tb7V.cjs.map} +1 -1
- package/dist/{UsersSection-mOOjcUEv.js → UsersSection-Dbh9PTSA.js} +17 -15
- package/dist/{UsersSection-mOOjcUEv.js.map → UsersSection-Dbh9PTSA.js.map} +1 -1
- package/dist/WebhookSettings-BT5q6AZ8.js +17 -0
- package/dist/WebhookSettings-BT5q6AZ8.js.map +1 -0
- package/dist/WebhookSettings-BWl_wsvg.cjs +1 -0
- package/dist/WebhookSettings-BWl_wsvg.cjs.map +1 -0
- package/dist/WebhookSettings-DXNH5bal.cjs +1 -0
- package/dist/WebhookSettings-DXNH5bal.cjs.map +1 -0
- package/dist/{WebhookSettings-D0i0JhQD.js → WebhookSettings-bUg2u_p0.js} +4 -4
- package/dist/WebhookSettings-bUg2u_p0.js.map +1 -0
- package/dist/WithdrawalsSection-BL_LOUq8.cjs +1 -0
- package/dist/{WithdrawalsSection-igRQJfjj.cjs.map → WithdrawalsSection-BL_LOUq8.cjs.map} +1 -1
- package/dist/WithdrawalsSection-CN-lLnqX.js +20 -0
- package/dist/{WithdrawalsSection-Grebjjks.js.map → WithdrawalsSection-CN-lLnqX.js.map} +1 -1
- package/dist/admin-only.cjs +1 -0
- package/dist/admin-only.cjs.map +1 -0
- package/dist/{admin/types.d.ts → admin-only.d.ts} +228 -167
- package/dist/admin-only.js +8 -0
- package/dist/admin-only.js.map +1 -0
- package/dist/apiClient-B2JxVPlH.js +216 -0
- package/dist/apiClient-B2JxVPlH.js.map +1 -0
- package/dist/apiClient-CTTKhsYb.cjs +1 -0
- package/dist/apiClient-CTTKhsYb.cjs.map +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js.map +1 -1
- package/dist/email-only.cjs +1 -1
- package/dist/email-only.d.ts +634 -16
- package/dist/email-only.js +16 -13
- package/dist/email-only.js.map +1 -1
- package/dist/google-only.cjs +1 -1
- package/dist/google-only.d.ts +543 -13
- package/dist/google-only.js +11 -8
- package/dist/google-only.js.map +1 -1
- package/dist/index.cjs +2061 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5007 -144
- package/dist/index.js +13507 -116
- package/dist/index.js.map +1 -1
- package/dist/login-react.css +1 -1
- package/dist/plugin-5qRh-YhX.js +596 -0
- package/dist/plugin-5qRh-YhX.js.map +1 -0
- package/dist/plugin-BtYBW6JY.cjs +1 -0
- package/dist/plugin-BtYBW6JY.cjs.map +1 -0
- package/dist/sanitization-Bo_tn-L2.cjs +1 -0
- package/dist/sanitization-Bo_tn-L2.cjs.map +1 -0
- package/dist/sanitization-CQ-H1MSg.js +39 -0
- package/dist/sanitization-CQ-H1MSg.js.map +1 -0
- package/dist/shamir-AeLLfw0p.cjs +1 -0
- package/dist/shamir-AeLLfw0p.cjs.map +1 -0
- package/dist/{solanaKeypair-BlXol3nh.js → shamir-B0wConeK.js} +765 -757
- package/dist/shamir-B0wConeK.js.map +1 -0
- package/dist/silentWalletEnroll-B8pgdKZO.cjs +1 -0
- package/dist/silentWalletEnroll-B8pgdKZO.cjs.map +1 -0
- package/dist/silentWalletEnroll-DR2kPw7W.js +41 -0
- package/dist/silentWalletEnroll-DR2kPw7W.js.map +1 -0
- package/dist/solana-only.cjs +1 -1
- package/dist/solana-only.d.ts +594 -13
- package/dist/solana-only.js +12 -9
- package/dist/solana-only.js.map +1 -1
- package/dist/style.d.ts +1 -0
- package/dist/useAdminDeposits-BDY5KJ0-.js +151 -0
- package/dist/useAdminDeposits-BDY5KJ0-.js.map +1 -0
- package/dist/useAdminDeposits-Dvx3_UUE.cjs +1 -0
- package/dist/useAdminDeposits-Dvx3_UUE.cjs.map +1 -0
- package/dist/{ErrorMessage-DU2VBb85.js → useAuth-Bge6KaWN.js} +954 -1226
- package/dist/useAuth-Bge6KaWN.js.map +1 -0
- package/dist/useAuth-DhIDTLRd.cjs +1 -0
- package/dist/useAuth-DhIDTLRd.cjs.map +1 -0
- package/dist/useOrgs-Be3KH4ib.js +215 -0
- package/dist/useOrgs-Be3KH4ib.js.map +1 -0
- package/dist/useOrgs-CVbacmaQ.cjs +1 -0
- package/dist/useOrgs-CVbacmaQ.cjs.map +1 -0
- package/dist/useSystemSettings-D9Cr7ZTl.cjs +1 -0
- package/dist/useSystemSettings-D9Cr7ZTl.cjs.map +1 -0
- package/dist/useSystemSettings-DN5YqfNq.js +97 -0
- package/dist/useSystemSettings-DN5YqfNq.js.map +1 -0
- package/dist/{validation-BebL7hMF.js → validation-B8kMV3BL.js} +1 -1
- package/dist/{validation-BebL7hMF.js.map → validation-B8kMV3BL.js.map} +1 -1
- package/dist/{validation-BeXIfuHB.cjs → validation-BuGQrA-K.cjs} +1 -1
- package/dist/{validation-BeXIfuHB.cjs.map → validation-BuGQrA-K.cjs.map} +1 -1
- package/package.json +11 -1
- package/dist/AuthenticationSettings-D8oXHkM6.cjs +0 -1
- package/dist/AuthenticationSettings-D8oXHkM6.cjs.map +0 -1
- package/dist/AuthenticationSettings-DlVILxY4.js.map +0 -1
- package/dist/CreditSystemSettings-Bv6u9lTs.js +0 -9
- package/dist/CreditSystemSettings-Bv6u9lTs.js.map +0 -1
- package/dist/CreditSystemSettings-D45pwDZM.cjs +0 -1
- package/dist/CreditSystemSettings-D45pwDZM.cjs.map +0 -1
- package/dist/DepositsSection-DpRn0koq.cjs +0 -1
- package/dist/EmailRegisterForm-C0PStlj5.js +0 -961
- package/dist/EmailRegisterForm-C0PStlj5.js.map +0 -1
- package/dist/EmailRegisterForm-DaPLGws2.cjs +0 -1
- package/dist/EmailRegisterForm-DaPLGws2.cjs.map +0 -1
- package/dist/EmailSettings-DdjoMO_c.cjs +0 -1
- package/dist/EmailSettings-DdjoMO_c.cjs.map +0 -1
- package/dist/EmailSettings-khmiWqhx.js +0 -9
- package/dist/EmailSettings-khmiWqhx.js.map +0 -1
- package/dist/EmbeddedWalletSettings-Bff6raAT.js.map +0 -1
- package/dist/EmbeddedWalletSettings-C5qkJtAr.cjs +0 -1
- package/dist/EmbeddedWalletSettings-C5qkJtAr.cjs.map +0 -1
- package/dist/ErrorMessage-BXHiYibN.cjs +0 -1
- package/dist/ErrorMessage-BXHiYibN.cjs.map +0 -1
- package/dist/ErrorMessage-DU2VBb85.js.map +0 -1
- package/dist/GoogleLoginButton-DoAdOqb3.cjs +0 -1
- package/dist/ServerSettings-BpZhkxh6.cjs +0 -1
- package/dist/ServerSettings-BpZhkxh6.cjs.map +0 -1
- package/dist/ServerSettings-UIVR0R4l.js.map +0 -1
- package/dist/SolanaLoginButton-CPzms0kf.cjs +0 -1
- package/dist/TeamSection-BoGqQhD5.cjs +0 -1
- package/dist/TeamSection-BoGqQhD5.cjs.map +0 -1
- package/dist/TeamSection-DnJudC38.js.map +0 -1
- package/dist/UsersSection-Ce7xVKfp.cjs +0 -1
- package/dist/WebhookSettings-Cx-BxzNQ.cjs +0 -1
- package/dist/WebhookSettings-Cx-BxzNQ.cjs.map +0 -1
- package/dist/WebhookSettings-D0i0JhQD.js.map +0 -1
- package/dist/WithdrawalsSection-Grebjjks.js +0 -20
- package/dist/WithdrawalsSection-igRQJfjj.cjs +0 -1
- package/dist/admin/AdminShell.d.ts +0 -38
- package/dist/admin/icons.d.ts +0 -2
- package/dist/admin/index.d.ts +0 -10
- package/dist/admin/plugin.d.ts +0 -3
- package/dist/admin/sections/AuthenticationSettings.d.ts +0 -3
- package/dist/admin/sections/CreditSystemSettings.d.ts +0 -3
- package/dist/admin/sections/DepositsSection.d.ts +0 -3
- package/dist/admin/sections/EmailSettings.d.ts +0 -3
- package/dist/admin/sections/EmbeddedWalletSettings.d.ts +0 -3
- package/dist/admin/sections/FeatureSettings.d.ts +0 -3
- package/dist/admin/sections/InvitesSection.d.ts +0 -3
- package/dist/admin/sections/MembersSection.d.ts +0 -3
- package/dist/admin/sections/ServerSettings.d.ts +0 -3
- package/dist/admin/sections/SettingsSections.d.ts +0 -7
- package/dist/admin/sections/TeamSection.d.ts +0 -3
- package/dist/admin/sections/UsersSection.d.ts +0 -3
- package/dist/admin/sections/WebhookSettings.d.ts +0 -3
- package/dist/admin/sections/WithdrawalsSection.d.ts +0 -3
- package/dist/components/LoginButton.d.ts +0 -23
- package/dist/components/LoginForm.d.ts +0 -9
- package/dist/components/LoginModal.d.ts +0 -9
- package/dist/components/admin/AdminUserDetail.d.ts +0 -23
- package/dist/components/admin/AdminUserList.d.ts +0 -21
- package/dist/components/admin/CedrosAdminDashboard.d.ts +0 -52
- package/dist/components/admin/PermissionsSection.d.ts +0 -7
- package/dist/components/admin/ProfileDropdown.d.ts +0 -34
- package/dist/components/admin/SetupWizard.d.ts +0 -30
- package/dist/components/admin/StatsBar.d.ts +0 -17
- package/dist/components/admin/SystemSettings.d.ts +0 -19
- package/dist/components/admin/settings/AuthenticationSettings.d.ts +0 -4
- package/dist/components/admin/settings/AutosaveStatus.d.ts +0 -6
- package/dist/components/admin/settings/CreditSystemSettings.d.ts +0 -6
- package/dist/components/admin/settings/EmailSettings.d.ts +0 -4
- package/dist/components/admin/settings/EmbeddedWalletSettings.d.ts +0 -4
- package/dist/components/admin/settings/FeatureSettings.d.ts +0 -4
- package/dist/components/admin/settings/MessagingSettings.d.ts +0 -4
- package/dist/components/admin/settings/SecuritySettings.d.ts +0 -4
- package/dist/components/admin/settings/ServerSettings.d.ts +0 -4
- package/dist/components/admin/settings/SettingsPageLayout.d.ts +0 -16
- package/dist/components/admin/settings/SsoProvidersSettings.d.ts +0 -4
- package/dist/components/admin/settings/WebhookSettings.d.ts +0 -4
- package/dist/components/admin/settings/index.d.ts +0 -31
- package/dist/components/admin/settings/settingsInputs.d.ts +0 -79
- package/dist/components/admin/settings/settingsMetadata.d.ts +0 -18
- package/dist/components/apple/AppleLoginButton.d.ts +0 -29
- package/dist/components/deposit/CreditBalance.d.ts +0 -19
- package/dist/components/deposit/DepositFlow.d.ts +0 -118
- package/dist/components/deposit/FeeConfigDisplay.d.ts +0 -15
- package/dist/components/deposit/History.d.ts +0 -21
- package/dist/components/deposit/TieredAmountSlider.d.ts +0 -19
- package/dist/components/deposit/TokenSelector.d.ts +0 -23
- package/dist/components/deposit/admin/AdminDepositList.d.ts +0 -21
- package/dist/components/deposit/admin/AdminDepositStats.d.ts +0 -15
- package/dist/components/deposit/admin/AdminPrivacyPeriodDeposits.d.ts +0 -19
- package/dist/components/deposit/admin/AdminWithdrawalHistory.d.ts +0 -19
- package/dist/components/deposit/admin/AdminWithdrawalQueue.d.ts +0 -23
- package/dist/components/deposit/admin/AdminWithdrawalStats.d.ts +0 -10
- package/dist/components/deposit/admin/FeatureDisabledMessage.d.ts +0 -15
- package/dist/components/deposit/admin/PrivacySystemStatus.d.ts +0 -15
- package/dist/components/deposit/admin/featureDisabled.d.ts +0 -14
- package/dist/components/deposit/admin/index.d.ts +0 -22
- package/dist/components/deposit/index.d.ts +0 -12
- package/dist/components/deposit/tierUtils.d.ts +0 -8
- package/dist/components/deposit/tokens.d.ts +0 -19
- package/dist/components/email/EmailLoginForm.d.ts +0 -11
- package/dist/components/email/EmailRegisterForm.d.ts +0 -14
- package/dist/components/email/ForgotPasswordForm.d.ts +0 -17
- package/dist/components/email/PasswordInput.d.ts +0 -14
- package/dist/components/email/ResetPasswordForm.d.ts +0 -22
- package/dist/components/google/GoogleLoginButton.d.ts +0 -12
- package/dist/components/invites/InviteForm.d.ts +0 -38
- package/dist/components/invites/InviteList.d.ts +0 -40
- package/dist/components/members/MemberList.d.ts +0 -47
- package/dist/components/org/CreateOrgForm.d.ts +0 -7
- package/dist/components/org/OrgAvatar.d.ts +0 -7
- package/dist/components/org/OrgListView.d.ts +0 -9
- package/dist/components/org/OrgSelector.d.ts +0 -52
- package/dist/components/org/OrgSwitcher.d.ts +0 -47
- package/dist/components/org/icons.d.ts +0 -8
- package/dist/components/profile/UserProfileSettings.d.ts +0 -35
- package/dist/components/profile/index.d.ts +0 -2
- package/dist/components/sessions/SessionList.d.ts +0 -33
- package/dist/components/shared/ErrorBoundary.d.ts +0 -38
- package/dist/components/shared/ErrorMessage.d.ts +0 -14
- package/dist/components/shared/LoadingSpinner.d.ts +0 -16
- package/dist/components/solana/SolanaLoginButton.d.ts +0 -49
- package/dist/components/templates/FullPageLayout.d.ts +0 -40
- package/dist/components/templates/SplitPageLayout.d.ts +0 -44
- package/dist/components/templates/index.d.ts +0 -4
- package/dist/components/totp/OtpInput.d.ts +0 -32
- package/dist/components/totp/QrCode.d.ts +0 -21
- package/dist/components/totp/TotpSettings.d.ts +0 -38
- package/dist/components/totp/TotpSetup.d.ts +0 -23
- package/dist/components/totp/TotpVerify.d.ts +0 -25
- package/dist/components/totp/index.d.ts +0 -10
- package/dist/components/wallet/CapabilityWarning.d.ts +0 -11
- package/dist/components/wallet/PasskeyPrompt.d.ts +0 -34
- package/dist/components/wallet/RecoveryPhraseDisplay.d.ts +0 -18
- package/dist/components/wallet/RecoveryPhraseInput.d.ts +0 -21
- package/dist/components/wallet/WalletAddressRow.d.ts +0 -10
- package/dist/components/wallet/WalletEnrollment.d.ts +0 -15
- package/dist/components/wallet/WalletManager.d.ts +0 -9
- package/dist/components/wallet/WalletRecovery.d.ts +0 -19
- package/dist/components/wallet/WalletStatus.d.ts +0 -28
- package/dist/components/wallet/WalletUnlock.d.ts +0 -23
- package/dist/components/wallet/index.d.ts +0 -23
- package/dist/components/webauthn/PasskeyLoginButton.d.ts +0 -8
- package/dist/context/CedrosLoginContext.d.ts +0 -24
- package/dist/context/CedrosLoginProvider.d.ts +0 -17
- package/dist/context/EmbeddedWalletExposure.d.ts +0 -19
- package/dist/context/useCedrosLogin.d.ts +0 -12
- package/dist/crypto/aesGcm.d.ts +0 -89
- package/dist/crypto/argon2.d.ts +0 -65
- package/dist/crypto/argon2Worker.d.ts +0 -1
- package/dist/crypto/argon2WorkerClient.d.ts +0 -28
- package/dist/crypto/bip39.d.ts +0 -106
- package/dist/crypto/capabilities.d.ts +0 -35
- package/dist/crypto/entropy.d.ts +0 -56
- package/dist/crypto/hkdf.d.ts +0 -38
- package/dist/crypto/index.d.ts +0 -30
- package/dist/crypto/secureWipe.d.ts +0 -71
- package/dist/crypto/shamir.d.ts +0 -52
- package/dist/crypto/solanaKeypair.d.ts +0 -63
- package/dist/crypto/types.d.ts +0 -134
- package/dist/crypto/webauthnPrf.d.ts +0 -108
- package/dist/hooks/useAdminDeposits.d.ts +0 -10
- package/dist/hooks/useAdminUsers.d.ts +0 -28
- package/dist/hooks/useAppleAuth.d.ts +0 -52
- package/dist/hooks/useAuth.d.ts +0 -34
- package/dist/hooks/useAuthSession.d.ts +0 -19
- package/dist/hooks/useAuthorize.d.ts +0 -62
- package/dist/hooks/useCredits.d.ts +0 -11
- package/dist/hooks/useDashboardPermissions.d.ts +0 -45
- package/dist/hooks/useDeposit.d.ts +0 -16
- package/dist/hooks/useEmailAuth.d.ts +0 -60
- package/dist/hooks/useGoogleAuth.d.ts +0 -67
- package/dist/hooks/useInstantLink.d.ts +0 -42
- package/dist/hooks/useInvites.d.ts +0 -57
- package/dist/hooks/useMembers.d.ts +0 -52
- package/dist/hooks/useOrgs.d.ts +0 -49
- package/dist/hooks/usePasswordReset.d.ts +0 -32
- package/dist/hooks/usePendingRecovery.d.ts +0 -34
- package/dist/hooks/useProfile.d.ts +0 -35
- package/dist/hooks/useRateLimiter.d.ts +0 -58
- package/dist/hooks/useServerFeatures.d.ts +0 -55
- package/dist/hooks/useSessions.d.ts +0 -45
- package/dist/hooks/useSettingsAutosave.d.ts +0 -29
- package/dist/hooks/useSetup.d.ts +0 -25
- package/dist/hooks/useSolanaAuth.d.ts +0 -30
- package/dist/hooks/useSsoProviders.d.ts +0 -52
- package/dist/hooks/useSystemSettings.d.ts +0 -47
- package/dist/hooks/useThemeManager.d.ts +0 -11
- package/dist/hooks/useTotp.d.ts +0 -52
- package/dist/hooks/useTotpVerify.d.ts +0 -38
- package/dist/hooks/useTransactionSigning.d.ts +0 -45
- package/dist/hooks/useWallet.d.ts +0 -10
- package/dist/hooks/useWalletDiscovery.d.ts +0 -24
- package/dist/hooks/useWalletEnrollment.d.ts +0 -9
- package/dist/hooks/useWalletMaterial.d.ts +0 -10
- package/dist/hooks/useWalletRecovery.d.ts +0 -9
- package/dist/hooks/useWalletSigning.d.ts +0 -31
- package/dist/hooks/useWebAuthn.d.ts +0 -25
- package/dist/i18n/I18nProvider.d.ts +0 -16
- package/dist/i18n/context.d.ts +0 -6
- package/dist/i18n/index.d.ts +0 -5
- package/dist/i18n/translations.d.ts +0 -66
- package/dist/i18n/useI18n.d.ts +0 -9
- package/dist/index-BI9Bj9DF.js +0 -19650
- package/dist/index-BI9Bj9DF.js.map +0 -1
- package/dist/index-CDRTfEJz.cjs +0 -2061
- package/dist/index-CDRTfEJz.cjs.map +0 -1
- package/dist/silentWalletEnroll-C3JRAD9_.js +0 -42
- package/dist/silentWalletEnroll-C3JRAD9_.js.map +0 -1
- package/dist/silentWalletEnroll-DRYQAQfg.cjs +0 -1
- package/dist/silentWalletEnroll-DRYQAQfg.cjs.map +0 -1
- package/dist/solanaKeypair-BlXol3nh.js.map +0 -1
- package/dist/solanaKeypair-C-lIR1JY.cjs +0 -1
- package/dist/solanaKeypair-C-lIR1JY.cjs.map +0 -1
- package/dist/types/adminUser.d.ts +0 -168
- package/dist/types/auth.d.ts +0 -122
- package/dist/types/config.d.ts +0 -266
- package/dist/types/deposit.d.ts +0 -490
- package/dist/types/index.d.ts +0 -13
- package/dist/types/invite.d.ts +0 -71
- package/dist/types/member.d.ts +0 -45
- package/dist/types/org.d.ts +0 -133
- package/dist/types/profile.d.ts +0 -56
- package/dist/types/session.d.ts +0 -28
- package/dist/types/setup.d.ts +0 -47
- package/dist/types/systemSettings.d.ts +0 -85
- package/dist/types/totp.d.ts +0 -52
- package/dist/types/wallet.d.ts +0 -309
- package/dist/utils/adminUserApi.d.ts +0 -60
- package/dist/utils/apiClient.d.ts +0 -78
- package/dist/utils/cryptoShim.d.ts +0 -17
- package/dist/utils/csrf.d.ts +0 -1
- package/dist/utils/deviceDetection.d.ts +0 -17
- package/dist/utils/embeddedWallet.d.ts +0 -75
- package/dist/utils/inviteApi.d.ts +0 -31
- package/dist/utils/memberApi.d.ts +0 -23
- package/dist/utils/orgApi.d.ts +0 -36
- package/dist/utils/profileApi.d.ts +0 -26
- package/dist/utils/sanitization.d.ts +0 -66
- package/dist/utils/sessionApi.d.ts +0 -16
- package/dist/utils/setupApi.d.ts +0 -21
- package/dist/utils/silentWalletEnroll.d.ts +0 -41
- package/dist/utils/systemSettingsApi.d.ts +0 -18
- package/dist/utils/tabSync.d.ts +0 -46
- package/dist/utils/tokenManager.d.ts +0 -107
- package/dist/utils/unlockCredential.d.ts +0 -5
- package/dist/utils/validation.d.ts +0 -48
- package/dist/utils/walletDetection.d.ts +0 -23
- package/dist/utils/webauthnJson.d.ts +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-5qRh-YhX.js","sources":["../src/components/admin/ProfileDropdown.tsx","../src/admin/AdminShell.tsx","../src/admin/icons.tsx","../src/admin/plugin.tsx"],"sourcesContent":["/**\n * Profile Dropdown Component\n *\n * Displays user avatar/name with a dropdown menu for settings and logout.\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\n\nexport interface ProfileDropdownProps {\n /** User's display name */\n name?: string;\n /** User's email */\n email?: string;\n /** User's profile picture URL */\n picture?: string;\n /** Callback when Settings is clicked */\n onSettings?: () => void;\n /** Callback when Logout is clicked */\n onLogout?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n/**\n * Profile dropdown button with settings and logout options.\n *\n * @example\n * ```tsx\n * <ProfileDropdown\n * name={user.name}\n * email={user.email}\n * picture={user.picture}\n * onSettings={() => navigate('/settings')}\n * onLogout={logout}\n * />\n * ```\n */\nexport function ProfileDropdown({\n name,\n email,\n picture,\n onSettings,\n onLogout,\n className = '',\n}: ProfileDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }\n }, [isOpen]);\n\n // Close dropdown on escape key\n useEffect(() => {\n function handleEscape(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const handleSettings = useCallback(() => {\n setIsOpen(false);\n onSettings?.();\n }, [onSettings]);\n\n const handleLogout = useCallback(() => {\n setIsOpen(false);\n onLogout?.();\n }, [onLogout]);\n\n const displayName = name || 'User';\n const initial = (name?.[0] || email?.[0] || '?').toUpperCase();\n\n return (\n <div className={`cedros-profile-dropdown ${className}`} ref={dropdownRef}>\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__trigger\"\n onClick={() => setIsOpen(!isOpen)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n >\n <div className=\"cedros-profile-dropdown__avatar\">\n {picture ? (\n <img\n src={picture}\n alt={displayName}\n className=\"cedros-profile-dropdown__avatar-img\"\n referrerPolicy=\"no-referrer\"\n />\n ) : (\n <span className=\"cedros-profile-dropdown__avatar-placeholder\">{initial}</span>\n )}\n </div>\n <div className=\"cedros-profile-dropdown__info\">\n <span className=\"cedros-profile-dropdown__name\">{displayName}</span>\n {email && <span className=\"cedros-profile-dropdown__email\">{email}</span>}\n </div>\n <svg\n className={`cedros-profile-dropdown__chevron ${isOpen ? 'cedros-profile-dropdown__chevron--open' : ''}`}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"cedros-profile-dropdown__menu\" role=\"menu\">\n {onSettings && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item\"\n onClick={handleSettings}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n Settings\n </button>\n )}\n {onLogout && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger\"\n onClick={handleLogout}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n Log out\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n","/**\n * AdminShell - Unified Admin Dashboard Host\n *\n * A shell component that hosts admin plugins from cedros-login, cedros-pay,\n * or any compatible plugin. Provides unified sidebar navigation and content area.\n *\n * @example\n * ```tsx\n * import { AdminShell } from '@cedros/login-react';\n * import { cedrosLoginPlugin } from '@cedros/login-react';\n * import { cedrosPayPlugin } from '@cedros/pay-react';\n *\n * function AdminPage() {\n * const hostContext = useBuildHostContext();\n * return (\n * <AdminShell\n * plugins={[cedrosLoginPlugin, cedrosPayPlugin]}\n * hostContext={hostContext}\n * />\n * );\n * }\n * ```\n */\n\nimport React, {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n Suspense,\n type ReactNode,\n} from 'react';\nimport type {\n AdminPlugin,\n PluginRegistry,\n HostContext,\n QualifiedSectionId,\n PluginContext,\n ResolvedSection,\n} from './types';\nimport { LoadingSpinner } from '../components/shared/LoadingSpinner';\nimport { ProfileDropdown } from '../components/admin/ProfileDropdown';\nimport { CedrosLoginContext, type CedrosLoginContextValue } from '../context/CedrosLoginContext';\nimport type { AuthUser } from '../types';\n\n// ============================================================================\n// Plugin Registry Implementation\n// ============================================================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private plugins = new Map<string, AdminPlugin>();\n private listeners = new Set<(plugins: AdminPlugin[]) => void>();\n\n register(plugin: AdminPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`Plugin ${plugin.id} already registered, replacing...`);\n }\n this.plugins.set(plugin.id, plugin);\n plugin.onRegister?.(this);\n this.notify();\n }\n\n unregister(pluginId: string): void {\n const plugin = this.plugins.get(pluginId);\n if (plugin) {\n plugin.onUnregister?.();\n this.plugins.delete(pluginId);\n this.notify();\n }\n }\n\n get(pluginId: string): AdminPlugin | undefined {\n return this.plugins.get(pluginId);\n }\n\n getAll(): AdminPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n subscribe(listener: (plugins: AdminPlugin[]) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(): void {\n const plugins = this.getAll();\n this.listeners.forEach((listener) => listener(plugins));\n }\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\ninterface AdminShellContextValue {\n registry: PluginRegistry;\n hostContext: HostContext;\n activeSection: QualifiedSectionId | null;\n setActiveSection: (section: QualifiedSectionId) => void;\n getPluginContext: (pluginId: string) => PluginContext | null;\n}\n\nconst AdminShellContext = createContext<AdminShellContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useAdminShell(): AdminShellContextValue {\n const ctx = useContext(AdminShellContext);\n if (!ctx) throw new Error('useAdminShell must be used within AdminShell');\n return ctx;\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface AdminShellProps {\n /** Dashboard title */\n title?: string;\n /** Plugins to load */\n plugins?: AdminPlugin[];\n /** Host context from parent providers */\n hostContext: HostContext;\n /** Default active section (qualified ID) */\n defaultSection?: QualifiedSectionId;\n /** Page size for lists */\n pageSize?: number;\n /** Refresh interval in ms (0 to disable) */\n refreshInterval?: number;\n /** Callback when section changes */\n onSectionChange?: (section: QualifiedSectionId) => void;\n /** Custom logo/header content */\n logo?: ReactNode;\n /** Additional sidebar footer content */\n sidebarFooter?: ReactNode;\n /** Callback when user clicks Settings in profile dropdown */\n onSettingsClick?: () => void;\n /** Callback when user clicks Logout in profile dropdown */\n onLogoutClick?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n// ============================================================================\n// Group Order Helpers\n// ============================================================================\n\n/** Build a group-label → order map from all registered plugins' groups[] config. */\nfunction buildGroupOrder(plugins: AdminPlugin[]): Map<string, number> {\n const order = new Map<string, number>();\n for (const plugin of plugins) {\n for (const group of plugin.groups ?? []) {\n // Key by label (sections reference groups by display name via section.group).\n // First plugin to declare a group wins; later plugins don't override.\n if (!order.has(group.label)) {\n order.set(group.label, group.order);\n }\n }\n }\n return order;\n}\n\n// ============================================================================\n// AdminShell Component\n// ============================================================================\n\nexport function AdminShell({\n title = 'Admin',\n plugins: initialPlugins = [],\n hostContext,\n defaultSection,\n pageSize = 20,\n refreshInterval = 0,\n onSectionChange,\n logo,\n sidebarFooter,\n onSettingsClick,\n onLogoutClick,\n className = '',\n}: AdminShellProps): React.JSX.Element {\n // Plugin registry\n const [registry] = useState(() => {\n const reg = new PluginRegistryImpl();\n initialPlugins.forEach((p) => reg.register(p));\n return reg;\n });\n\n // Track registered plugins for re-renders\n const [registeredPlugins, setRegisteredPlugins] = useState<AdminPlugin[]>(() =>\n registry.getAll()\n );\n\n useEffect(() => {\n return registry.subscribe(setRegisteredPlugins);\n }, [registry]);\n\n // Aggregate sections from all plugins\n const allSections = useMemo(() => {\n return registeredPlugins.flatMap((plugin) =>\n plugin.sections\n .filter((section) => {\n // Check RBAC permissions (role-based)\n if (section.requiredPermission) {\n if (!plugin.checkPermission(section.requiredPermission, hostContext)) {\n return false;\n }\n }\n // Check dashboard section permissions (owner-configured per role)\n if (hostContext.dashboardPermissions) {\n if (!hostContext.dashboardPermissions.canAccess(section.id)) {\n return false;\n }\n }\n return true;\n })\n .map(\n (section): ResolvedSection => ({\n ...section,\n qualifiedId: `${plugin.id}:${section.id}` as QualifiedSectionId,\n pluginId: plugin.id,\n cssNamespace: plugin.cssNamespace,\n })\n )\n );\n }, [registeredPlugins, hostContext]);\n\n // Active section state\n const [activeSection, setActiveSectionInternal] = useState<QualifiedSectionId | null>(\n () => defaultSection ?? allSections[0]?.qualifiedId ?? null\n );\n\n // Collapsible groups state\n const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());\n\n const toggleGroup = useCallback((groupName: string) => {\n setCollapsedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(groupName)) {\n next.delete(groupName);\n } else {\n next.add(groupName);\n }\n return next;\n });\n }, []);\n\n // Update active section when sections change and current is invalid\n useEffect(() => {\n if (activeSection && !allSections.find((s) => s.qualifiedId === activeSection)) {\n setActiveSectionInternal(allSections[0]?.qualifiedId ?? null);\n }\n }, [allSections, activeSection]);\n\n const setActiveSection = useCallback(\n (section: QualifiedSectionId) => {\n setActiveSectionInternal(section);\n onSectionChange?.(section);\n },\n [onSectionChange]\n );\n\n // Plugin context factory\n const getPluginContext = useCallback(\n (pluginId: string): PluginContext | null => {\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n return plugin.createPluginContext(hostContext);\n },\n [registry, hostContext]\n );\n\n // Group sections by group name, sorted by plugin-defined group order\n const groupedSections = useMemo(() => {\n const groupOrder = buildGroupOrder(registeredPlugins);\n const groups = new Map<string, ResolvedSection[]>();\n\n allSections.forEach((section) => {\n const groupName = section.group ?? 'Menu';\n const existing = groups.get(groupName) ?? [];\n groups.set(groupName, [...existing, section]);\n });\n\n // Sort groups by plugin-defined order (undeclared groups sink to bottom)\n const sortedGroups = Array.from(groups.entries()).sort(([a], [b]) => {\n const orderA = groupOrder.get(a) ?? 99;\n const orderB = groupOrder.get(b) ?? 99;\n return orderA - orderB;\n });\n\n return sortedGroups;\n }, [allSections, registeredPlugins]);\n\n // Get current section's component\n const currentSection = useMemo(() => {\n if (!activeSection) return null;\n const [pluginId, sectionId] = activeSection.split(':') as [string, string];\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n const Component = plugin.components[sectionId];\n if (!Component) return null;\n const pluginContext = plugin.createPluginContext(hostContext);\n return { Component, pluginContext, plugin };\n }, [activeSection, registry, hostContext]);\n\n // Context value\n const contextValue = useMemo<AdminShellContextValue>(\n () => ({\n registry,\n hostContext,\n activeSection,\n setActiveSection,\n getPluginContext,\n }),\n [registry, hostContext, activeSection, setActiveSection, getPluginContext]\n );\n\n // Bridge hostContext.cedrosLogin into CedrosLoginContext so hooks\n // (useOrgs, useAdminDeposits, etc.) work inside AdminShell sections.\n const cedrosLoginContextValue = useMemo<CedrosLoginContextValue | null>(() => {\n const cl = hostContext.cedrosLogin;\n if (!cl) return null;\n const user: AuthUser | null = cl.user\n ? { authMethods: [], emailVerified: false, createdAt: '', updatedAt: '', ...cl.user }\n : null;\n return {\n config: { serverUrl: cl.serverUrl },\n user,\n authState: cl.user ? 'authenticated' : 'unauthenticated',\n error: null,\n logout: async () => {},\n refreshUser: async () => {},\n isModalOpen: false,\n openModal: () => {},\n closeModal: () => {},\n _internal: {\n handleLoginSuccess: () => {},\n getAccessToken: cl.getAccessToken,\n },\n };\n }, [hostContext.cedrosLogin]);\n\n return (\n <AdminShellContext.Provider value={contextValue}>\n <CedrosLoginContext.Provider value={cedrosLoginContextValue}>\n <div className={`cedros-admin cedros-admin-shell ${className || ''}`}>\n {/* Sidebar */}\n <aside className=\"cedros-admin-shell__sidebar\">\n <div className=\"cedros-admin-shell__sidebar-header\">\n {logo ?? (\n <div className=\"cedros-admin-shell__logo\">\n <span className=\"cedros-admin-shell__logo-text\">{title}</span>\n </div>\n )}\n </div>\n\n <nav className=\"cedros-admin-shell__nav\">\n {groupedSections.map(([groupName, sections]) => {\n const isCollapsible = groupName === 'Configuration';\n const isCollapsed = collapsedGroups.has(groupName);\n\n return (\n <div key={groupName} className=\"cedros-admin-shell__nav-group\">\n {isCollapsible ? (\n <button\n type=\"button\"\n className=\"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible\"\n onClick={() => toggleGroup(groupName)}\n aria-expanded={!isCollapsed}\n >\n <span>{groupName}</span>\n <span\n className={`cedros-admin-shell__nav-chevron ${!isCollapsed ? 'cedros-admin-shell__nav-chevron--expanded' : ''}`}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </span>\n </button>\n ) : (\n <span className=\"cedros-admin-shell__nav-label\">{groupName}</span>\n )}\n {(!isCollapsible || !isCollapsed) &&\n sections\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n .map((section) => (\n <button\n key={section.qualifiedId}\n type=\"button\"\n className={`cedros-admin-shell__nav-item ${\n activeSection === section.qualifiedId\n ? 'cedros-admin-shell__nav-item--active'\n : ''\n }`}\n onClick={() => setActiveSection(section.qualifiedId)}\n aria-current={\n activeSection === section.qualifiedId ? 'page' : undefined\n }\n >\n <span className=\"cedros-admin-shell__nav-icon\">{section.icon}</span>\n <span className=\"cedros-admin-shell__nav-text\">{section.label}</span>\n {section.badge && (\n <span className=\"cedros-admin-shell__nav-badge\">{section.badge}</span>\n )}\n </button>\n ))}\n </div>\n );\n })}\n </nav>\n\n {/* User profile dropdown + optional custom footer */}\n {(hostContext.cedrosLogin?.user || sidebarFooter) && (\n <div className=\"cedros-admin-shell__sidebar-footer\">\n {hostContext.cedrosLogin?.user && (\n <ProfileDropdown\n name={hostContext.cedrosLogin.user.name}\n email={hostContext.cedrosLogin.user.email}\n picture={hostContext.cedrosLogin.user.picture}\n onSettings={onSettingsClick}\n onLogout={onLogoutClick}\n />\n )}\n {sidebarFooter}\n </div>\n )}\n </aside>\n\n {/* Main Content */}\n <main className=\"cedros-admin-shell__main\">\n {currentSection ? (\n <Suspense fallback={<LoadingFallback />}>\n <div\n className=\"cedros-admin-shell__section\"\n data-plugin-namespace={currentSection.plugin.cssNamespace}\n >\n <currentSection.Component\n pluginContext={currentSection.pluginContext}\n pageSize={pageSize}\n refreshInterval={refreshInterval}\n />\n </div>\n </Suspense>\n ) : (\n <div className=\"cedros-admin-shell__empty\">\n {allSections.length === 0\n ? 'No plugins loaded'\n : 'Select a section from the sidebar'}\n </div>\n )}\n </main>\n </div>\n </CedrosLoginContext.Provider>\n </AdminShellContext.Provider>\n );\n}\n\n// ============================================================================\n// Helper Components\n// ============================================================================\n\nfunction LoadingFallback(): React.JSX.Element {\n return (\n <div className=\"cedros-admin-shell__loading\">\n <LoadingSpinner />\n <span>Loading...</span>\n </div>\n );\n}\n","/**\n * Admin Dashboard Icons\n *\n * SVG icons for the admin dashboard sidebar and sections.\n * Lucide-style, 24x24 viewBox rendered at 16x16.\n */\n\nimport type { ReactNode } from 'react';\n\nconst iconProps = {\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n};\n\nexport const Icons: Record<string, ReactNode> = {\n users: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n members: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n invites: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n deposits: (\n <svg {...iconProps}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8\" />\n <path d=\"M12 18V6\" />\n </svg>\n ),\n\n withdrawals: (\n <svg {...iconProps}>\n <rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\" />\n <path d=\"M9 22v-4h6v4\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n </svg>\n ),\n\n settings: (\n <svg {...iconProps}>\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ),\n\n wallet: (\n <svg {...iconProps}>\n <path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" />\n </svg>\n ),\n\n chevronRight: (\n <svg {...iconProps}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n ),\n\n // Settings sub-page icons\n key: (\n <svg {...iconProps}>\n <path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\" />\n </svg>\n ),\n\n toggles: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"6\" />\n <circle cx=\"8\" cy=\"12\" r=\"2\" />\n </svg>\n ),\n\n shield: (\n <svg {...iconProps}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n ),\n\n mail: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n webhook: (\n <svg {...iconProps}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n ),\n\n coins: (\n <svg {...iconProps}>\n <circle cx=\"8\" cy=\"8\" r=\"6\" />\n <path d=\"M18.09 10.37A6 6 0 1 1 10.34 18\" />\n <path d=\"M7 6h1v4\" />\n <path d=\"m16.71 13.88.7.71-2.82 2.82\" />\n </svg>\n ),\n\n server: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n ),\n};\n","/**\n * Cedros Login Admin Plugin\n *\n * Exports the cedrosLoginPlugin for use with AdminShell.\n * Provides user management, deposits, withdrawals, and configuration sections.\n */\n\nimport { lazy } from 'react';\nimport type { AdminPlugin, HostContext, PluginContext, AdminSectionConfig } from './types';\nimport { Icons } from './icons';\n\n// ============================================================================\n// Lazy-loaded Section Components\n// ============================================================================\n\nconst UsersSection = lazy(() => import('./sections/UsersSection'));\nconst TeamSection = lazy(() => import('./sections/TeamSection'));\nconst DepositsSection = lazy(() => import('./sections/DepositsSection'));\nconst WithdrawalsSection = lazy(() => import('./sections/WithdrawalsSection'));\nconst AuthenticationSettings = lazy(() => import('./sections/AuthenticationSettings'));\nconst EmbeddedWalletSettings = lazy(() => import('./sections/EmbeddedWalletSettings'));\nconst EmailSettings = lazy(() => import('./sections/EmailSettings'));\nconst WebhookSettings = lazy(() => import('./sections/WebhookSettings'));\nconst CreditSystemSettings = lazy(() => import('./sections/CreditSystemSettings'));\nconst ServerSettings = lazy(() => import('./sections/ServerSettings'));\n\n// ============================================================================\n// Permission Mapping\n// ============================================================================\n\ntype LoginPermission =\n | 'login:users:read'\n | 'login:users:write'\n | 'login:members:read'\n | 'login:members:write'\n | 'login:invites:read'\n | 'login:invites:write'\n | 'login:deposits:read'\n | 'login:deposits:write'\n | 'login:settings:read'\n | 'login:settings:write';\n\n/**\n * Maps plugin permissions to org-level permissions/roles.\n */\nconst PERMISSION_MAP: Record<LoginPermission, string[]> = {\n 'login:users:read': ['admin', 'owner'],\n 'login:users:write': ['admin', 'owner'],\n 'login:members:read': ['member:read', 'admin', 'owner'],\n 'login:members:write': ['member:remove', 'member:role_change'],\n 'login:invites:read': ['invite:read', 'admin', 'owner'],\n 'login:invites:write': ['invite:create', 'invite:cancel'],\n 'login:deposits:read': ['admin', 'owner'],\n 'login:deposits:write': ['admin', 'owner'],\n 'login:settings:read': ['admin', 'owner'],\n 'login:settings:write': ['admin', 'owner'],\n};\n\n// ============================================================================\n// Section Configuration\n// ============================================================================\n\nconst SECTIONS: AdminSectionConfig[] = [\n // Users group (main sections)\n {\n id: 'users',\n label: 'Users',\n icon: Icons.users,\n group: 'Users',\n order: 0,\n requiredPermission: 'login:users:read',\n },\n {\n id: 'team',\n label: 'Team',\n icon: Icons.members,\n group: 'Users',\n order: 1,\n requiredPermission: 'login:members:read',\n },\n {\n id: 'deposits',\n label: 'Deposits',\n icon: Icons.deposits,\n group: 'Users',\n order: 2,\n requiredPermission: 'login:deposits:read',\n },\n {\n id: 'withdrawals',\n label: 'Withdrawals',\n icon: Icons.withdrawals,\n group: 'Users',\n order: 3,\n requiredPermission: 'login:deposits:read',\n },\n\n // Configuration group (settings sections)\n {\n id: 'settings-auth',\n label: 'Authentication',\n icon: Icons.key,\n group: 'Configuration',\n order: 0,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-email',\n label: 'Email & SMTP',\n icon: Icons.mail,\n group: 'Configuration',\n order: 1,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-webhooks',\n label: 'Webhooks',\n icon: Icons.webhook,\n group: 'Configuration',\n order: 2,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-wallet',\n label: 'User Wallets',\n icon: Icons.wallet,\n group: 'Configuration',\n order: 3,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-credits',\n label: 'Credit System',\n icon: Icons.coins,\n group: 'Configuration',\n order: 4,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-server',\n label: 'Auth Server',\n icon: Icons.server,\n group: 'Configuration',\n order: 5,\n requiredPermission: 'login:settings:read',\n },\n];\n\n// ============================================================================\n// Plugin Definition\n// ============================================================================\n\nexport const cedrosLoginPlugin: AdminPlugin = {\n id: 'cedros-login',\n name: 'Cedros Login',\n version: '1.0.0',\n\n sections: SECTIONS,\n\n groups: [\n { id: 'users', label: 'Users', order: 0 },\n { id: 'configuration', label: 'Configuration', order: 2 },\n ],\n\n components: {\n users: UsersSection,\n team: TeamSection,\n deposits: DepositsSection,\n withdrawals: WithdrawalsSection,\n 'settings-auth': AuthenticationSettings,\n 'settings-wallet': EmbeddedWalletSettings,\n 'settings-email': EmailSettings,\n 'settings-webhooks': WebhookSettings,\n 'settings-credits': CreditSystemSettings,\n 'settings-server': ServerSettings,\n },\n\n createPluginContext(hostContext: HostContext): PluginContext {\n const cedrosLogin = hostContext.cedrosLogin;\n if (!cedrosLogin) {\n throw new Error('cedros-login plugin requires cedrosLogin in hostContext');\n }\n\n return {\n serverUrl: cedrosLogin.serverUrl,\n userId: cedrosLogin.user?.id,\n getAccessToken: cedrosLogin.getAccessToken,\n hasPermission: (permission) => this.checkPermission(permission, hostContext),\n orgId: hostContext.org?.orgId,\n pluginData: {\n user: cedrosLogin.user,\n orgRole: hostContext.org?.role,\n },\n };\n },\n\n checkPermission(permission: string, hostContext: HostContext): boolean {\n const org = hostContext.org;\n\n // No org context = admin-level access (for global admins)\n if (!org) {\n // Check if user is in cedrosLogin context - assume admin if present\n return Boolean(hostContext.cedrosLogin?.user);\n }\n\n const requiredPerms = PERMISSION_MAP[permission as LoginPermission];\n if (!requiredPerms) {\n // Unknown permission - default deny\n return false;\n }\n\n // Check if user has any of the required permissions\n return requiredPerms.some(\n (p) =>\n org.permissions.includes(p) ||\n p === org.role ||\n (p === 'admin' && ['admin', 'owner'].includes(org.role)) ||\n (p === 'owner' && org.role === 'owner')\n );\n },\n\n cssNamespace: 'cedros-dashboard',\n};\n\n// Named export for convenience\nexport { cedrosLoginPlugin as loginPlugin };\n"],"names":["ProfileDropdown","name","email","picture","onSettings","onLogout","className","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","handleSettings","useCallback","handleLogout","displayName","initial","jsxs","jsx","PluginRegistryImpl","plugin","pluginId","listener","plugins","AdminShellContext","createContext","useAdminShell","ctx","useContext","buildGroupOrder","order","group","AdminShell","title","initialPlugins","hostContext","defaultSection","pageSize","refreshInterval","onSectionChange","logo","sidebarFooter","onSettingsClick","onLogoutClick","registry","reg","p","registeredPlugins","setRegisteredPlugins","allSections","useMemo","section","activeSection","setActiveSectionInternal","collapsedGroups","setCollapsedGroups","toggleGroup","groupName","prev","next","s","setActiveSection","getPluginContext","groupedSections","groupOrder","groups","existing","a","b","orderA","orderB","currentSection","sectionId","Component","pluginContext","contextValue","cedrosLoginContextValue","cl","user","CedrosLoginContext","sections","isCollapsible","isCollapsed","Suspense","LoadingFallback","LoadingSpinner","iconProps","Icons","UsersSection","lazy","TeamSection","DepositsSection","WithdrawalsSection","AuthenticationSettings","EmbeddedWalletSettings","EmailSettings","WebhookSettings","CreditSystemSettings","ServerSettings","PERMISSION_MAP","SECTIONS","cedrosLoginPlugin","cedrosLogin","permission","org","requiredPerms"],"mappings":";;;AAqCO,SAASA,EAAgB;AAAA,EAC9B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAyB;AACvB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAcC,EAAuB,IAAI;AAG/C,E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AAO,iBAAiB,OAAO,EAAA;AAAA,EAAE;AAAA,EAG1D,YAAY;AAAA,IACV,OAAOZ;AAAA,IACP,MAAME;AAAA,IACN,UAAUC;AAAA,IACV,aAAaC;AAAA,IACb,iBAAiBC;AAAA,IACjB,mBAAmBC;AAAA,IACnB,kBAAkBC;AAAA,IAClB,qBAAqBC;AAAA,IACrB,oBAAoBC;AAAA,IACpB,mBAAmBC;AAAA,EAAA;AAAA,EAGrB,oBAAoB/D,GAAyC;AAC3D,UAAMmE,IAAcnE,EAAY;AAChC,QAAI,CAACmE;AACH,YAAM,IAAI,MAAM,yDAAyD;AAG3E,WAAO;AAAA,MACL,WAAWA,EAAY;AAAA,MACvB,QAAQA,EAAY,MAAM;AAAA,MAC1B,gBAAgBA,EAAY;AAAA,MAC5B,eAAe,CAACC,MAAe,KAAK,gBAAgBA,GAAYpE,CAAW;AAAA,MAC3E,OAAOA,EAAY,KAAK;AAAA,MACxB,YAAY;AAAA,QACV,MAAMmE,EAAY;AAAA,QAClB,SAASnE,EAAY,KAAK;AAAA,MAAA;AAAA,IAC5B;AAAA,EAEJ;AAAA,EAEA,gBAAgBoE,GAAoBpE,GAAmC;AACrE,UAAMqE,IAAMrE,EAAY;AAGxB,QAAI,CAACqE;AAEH,aAAO,EAAQrE,EAAY,aAAa;AAG1C,UAAMsE,IAAgBN,GAAeI,CAA6B;AAClE,WAAKE,IAMEA,EAAc;AAAA,MACnB,CAAC3D,MACC0D,EAAI,YAAY,SAAS1D,CAAC,KAC1BA,MAAM0D,EAAI,QACT1D,MAAM,WAAW,CAAC,SAAS,OAAO,EAAE,SAAS0D,EAAI,IAAI,KACrD1D,MAAM,WAAW0D,EAAI,SAAS;AAAA,IAAA,IAT1B;AAAA,EAWX;AAAA,EAEA,cAAc;AAChB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),n=require("react"),C=require("./LoadingSpinner-d6sSxgQN.cjs");function A({name:a,email:i,picture:r,onSettings:c,onLogout:p,className:P=""}){const[u,j]=n.useState(!1),w=n.useRef(null);n.useEffect(()=>{function x(_){w.current&&!w.current.contains(_.target)&&j(!1)}if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]),n.useEffect(()=>{function x(_){_.key==="Escape"&&j(!1)}if(u)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[u]);const S=n.useCallback(()=>{j(!1),c?.()},[c]),M=n.useCallback(()=>{j(!1),p?.()},[p]),y=a||"User",h=(a?.[0]||i?.[0]||"?").toUpperCase();return e.jsxs("div",{className:`cedros-profile-dropdown ${P}`,ref:w,children:[e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__trigger",onClick:()=>j(!u),"aria-expanded":u,"aria-haspopup":"menu",children:[e.jsx("div",{className:"cedros-profile-dropdown__avatar",children:r?e.jsx("img",{src:r,alt:y,className:"cedros-profile-dropdown__avatar-img",referrerPolicy:"no-referrer"}):e.jsx("span",{className:"cedros-profile-dropdown__avatar-placeholder",children:h})}),e.jsxs("div",{className:"cedros-profile-dropdown__info",children:[e.jsx("span",{className:"cedros-profile-dropdown__name",children:y}),i&&e.jsx("span",{className:"cedros-profile-dropdown__email",children:i})]}),e.jsx("svg",{className:`cedros-profile-dropdown__chevron ${u?"cedros-profile-dropdown__chevron--open":""}`,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),u&&e.jsxs("div",{className:"cedros-profile-dropdown__menu",role:"menu",children:[c&&e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__item",onClick:S,role:"menuitem",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"Settings"]}),p&&e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger",onClick:M,role:"menuitem",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",x2:"9",y1:"12",y2:"12"})]}),"Log out"]})]})]})}class T{plugins=new Map;listeners=new Set;register(i){this.plugins.has(i.id)&&console.warn(`Plugin ${i.id} already registered, replacing...`),this.plugins.set(i.id,i),i.onRegister?.(this),this.notify()}unregister(i){const r=this.plugins.get(i);r&&(r.onUnregister?.(),this.plugins.delete(i),this.notify())}get(i){return this.plugins.get(i)}getAll(){return Array.from(this.plugins.values())}subscribe(i){return this.listeners.add(i),()=>this.listeners.delete(i)}notify(){const i=this.getAll();this.listeners.forEach(r=>r(i))}}const I=n.createContext(null);function $(){const a=n.useContext(I);if(!a)throw new Error("useAdminShell must be used within AdminShell");return a}function B(a){const i=new Map;for(const r of a)for(const c of r.groups??[])i.has(c.label)||i.set(c.label,c.order);return i}function G({title:a="Admin",plugins:i=[],hostContext:r,defaultSection:c,pageSize:p=20,refreshInterval:P=0,onSectionChange:u,logo:j,sidebarFooter:w,onSettingsClick:S,onLogoutClick:M,className:y=""}){const[h]=n.useState(()=>{const s=new T;return i.forEach(o=>s.register(o)),s}),[x,_]=n.useState(()=>h.getAll());n.useEffect(()=>h.subscribe(_),[h]);const f=n.useMemo(()=>x.flatMap(s=>s.sections.filter(o=>!(o.requiredPermission&&!s.checkPermission(o.requiredPermission,r)||r.dashboardPermissions&&!r.dashboardPermissions.canAccess(o.id))).map(o=>({...o,qualifiedId:`${s.id}:${o.id}`,pluginId:s.id,cssNamespace:s.cssNamespace}))),[x,r]),[v,q]=n.useState(()=>c??f[0]?.qualifiedId??null),[E,U]=n.useState(new Set),z=n.useCallback(s=>{U(o=>{const d=new Set(o);return d.has(s)?d.delete(s):d.add(s),d})},[]);n.useEffect(()=>{v&&!f.find(s=>s.qualifiedId===v)&&q(f[0]?.qualifiedId??null)},[f,v]);const L=n.useCallback(s=>{q(s),u?.(s)},[u]),N=n.useCallback(s=>{const o=h.get(s);return o?o.createPluginContext(r):null},[h,r]),V=n.useMemo(()=>{const s=B(x),o=new Map;return f.forEach(g=>{const l=g.group??"Menu",b=o.get(l)??[];o.set(l,[...b,g])}),Array.from(o.entries()).sort(([g],[l])=>{const b=s.get(g)??99,O=s.get(l)??99;return b-O})},[f,x]),k=n.useMemo(()=>{if(!v)return null;const[s,o]=v.split(":"),d=h.get(s);if(!d)return null;const g=d.components[o];if(!g)return null;const l=d.createPluginContext(r);return{Component:g,pluginContext:l,plugin:d}},[v,h,r]),W=n.useMemo(()=>({registry:h,hostContext:r,activeSection:v,setActiveSection:L,getPluginContext:N}),[h,r,v,L,N]),R=n.useMemo(()=>{const s=r.cedrosLogin;if(!s)return null;const o=s.user?{authMethods:[],emailVerified:!1,createdAt:"",updatedAt:"",...s.user}:null;return{config:{serverUrl:s.serverUrl},user:o,authState:s.user?"authenticated":"unauthenticated",error:null,logout:async()=>{},refreshUser:async()=>{},isModalOpen:!1,openModal:()=>{},closeModal:()=>{},_internal:{handleLoginSuccess:()=>{},getAccessToken:s.getAccessToken}}},[r.cedrosLogin]);return e.jsx(I.Provider,{value:W,children:e.jsx(C.CedrosLoginContext.Provider,{value:R,children:e.jsxs("div",{className:`cedros-admin cedros-admin-shell ${y||""}`,children:[e.jsxs("aside",{className:"cedros-admin-shell__sidebar",children:[e.jsx("div",{className:"cedros-admin-shell__sidebar-header",children:j??e.jsx("div",{className:"cedros-admin-shell__logo",children:e.jsx("span",{className:"cedros-admin-shell__logo-text",children:a})})}),e.jsx("nav",{className:"cedros-admin-shell__nav",children:V.map(([s,o])=>{const d=s==="Configuration",g=E.has(s);return e.jsxs("div",{className:"cedros-admin-shell__nav-group",children:[d?e.jsxs("button",{type:"button",className:"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible",onClick:()=>z(s),"aria-expanded":!g,children:[e.jsx("span",{children:s}),e.jsx("span",{className:`cedros-admin-shell__nav-chevron ${g?"":"cedros-admin-shell__nav-chevron--expanded"}`,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})})]}):e.jsx("span",{className:"cedros-admin-shell__nav-label",children:s}),(!d||!g)&&o.sort((l,b)=>(l.order??0)-(b.order??0)).map(l=>e.jsxs("button",{type:"button",className:`cedros-admin-shell__nav-item ${v===l.qualifiedId?"cedros-admin-shell__nav-item--active":""}`,onClick:()=>L(l.qualifiedId),"aria-current":v===l.qualifiedId?"page":void 0,children:[e.jsx("span",{className:"cedros-admin-shell__nav-icon",children:l.icon}),e.jsx("span",{className:"cedros-admin-shell__nav-text",children:l.label}),l.badge&&e.jsx("span",{className:"cedros-admin-shell__nav-badge",children:l.badge})]},l.qualifiedId))]},s)})}),(r.cedrosLogin?.user||w)&&e.jsxs("div",{className:"cedros-admin-shell__sidebar-footer",children:[r.cedrosLogin?.user&&e.jsx(A,{name:r.cedrosLogin.user.name,email:r.cedrosLogin.user.email,picture:r.cedrosLogin.user.picture,onSettings:S,onLogout:M}),w]})]}),e.jsx("main",{className:"cedros-admin-shell__main",children:k?e.jsx(n.Suspense,{fallback:e.jsx(D,{}),children:e.jsx("div",{className:"cedros-admin-shell__section","data-plugin-namespace":k.plugin.cssNamespace,children:e.jsx(k.Component,{pluginContext:k.pluginContext,pageSize:p,refreshInterval:P})})}):e.jsx("div",{className:"cedros-admin-shell__empty",children:f.length===0?"No plugins loaded":"Select a section from the sidebar"})})]})})})}function D(){return e.jsxs("div",{className:"cedros-admin-shell__loading",children:[e.jsx(C.LoadingSpinner,{}),e.jsx("span",{children:"Loading..."})]})}const t={width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m={users:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),members:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),invites:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),deposits:e.jsxs("svg",{...t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"}),e.jsx("path",{d:"M12 18V6"})]}),withdrawals:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}),e.jsx("path",{d:"M9 22v-4h6v4"}),e.jsx("path",{d:"M8 6h.01"}),e.jsx("path",{d:"M16 6h.01"}),e.jsx("path",{d:"M12 6h.01"}),e.jsx("path",{d:"M12 10h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 10h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 10h.01"}),e.jsx("path",{d:"M8 14h.01"})]}),settings:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),wallet:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),e.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),chevronRight:e.jsx("svg",{...t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),key:e.jsx("svg",{...t,children:e.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})}),toggles:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"12",x:"2",y:"6",rx:"6"}),e.jsx("circle",{cx:"8",cy:"12",r:"2"})]}),shield:e.jsx("svg",{...t,children:e.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),mail:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),webhook:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2"}),e.jsx("path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06"}),e.jsx("path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8"})]}),coins:e.jsxs("svg",{...t,children:[e.jsx("circle",{cx:"8",cy:"8",r:"6"}),e.jsx("path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18"}),e.jsx("path",{d:"M7 6h1v4"}),e.jsx("path",{d:"m16.71 13.88.7.71-2.82 2.82"})]}),server:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),e.jsx("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),e.jsx("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})},H=n.lazy(()=>Promise.resolve().then(()=>require("./UsersSection-C2U8Tb7V.cjs"))),F=n.lazy(()=>Promise.resolve().then(()=>require("./TeamSection-DlUD5kp5.cjs"))),J=n.lazy(()=>Promise.resolve().then(()=>require("./DepositsSection-i6XdhLNs.cjs"))),K=n.lazy(()=>Promise.resolve().then(()=>require("./WithdrawalsSection-BL_LOUq8.cjs"))),Q=n.lazy(()=>Promise.resolve().then(()=>require("./AuthenticationSettings-5Vi7Ib_A.cjs"))),X=n.lazy(()=>Promise.resolve().then(()=>require("./EmbeddedWalletSettings-D6M7pwgk.cjs"))),Y=n.lazy(()=>Promise.resolve().then(()=>require("./EmailSettings-DZywTTRq.cjs"))),Z=n.lazy(()=>Promise.resolve().then(()=>require("./WebhookSettings-DXNH5bal.cjs"))),ee=n.lazy(()=>Promise.resolve().then(()=>require("./CreditSystemSettings-BnAOK_tT.cjs"))),se=n.lazy(()=>Promise.resolve().then(()=>require("./ServerSettings-BZXlm1BX.cjs"))),re={"login:users:read":["admin","owner"],"login:users:write":["admin","owner"],"login:members:read":["member:read","admin","owner"],"login:members:write":["member:remove","member:role_change"],"login:invites:read":["invite:read","admin","owner"],"login:invites:write":["invite:create","invite:cancel"],"login:deposits:read":["admin","owner"],"login:deposits:write":["admin","owner"],"login:settings:read":["admin","owner"],"login:settings:write":["admin","owner"]},ie=[{id:"users",label:"Users",icon:m.users,group:"Users",order:0,requiredPermission:"login:users:read"},{id:"team",label:"Team",icon:m.members,group:"Users",order:1,requiredPermission:"login:members:read"},{id:"deposits",label:"Deposits",icon:m.deposits,group:"Users",order:2,requiredPermission:"login:deposits:read"},{id:"withdrawals",label:"Withdrawals",icon:m.withdrawals,group:"Users",order:3,requiredPermission:"login:deposits:read"},{id:"settings-auth",label:"Authentication",icon:m.key,group:"Configuration",order:0,requiredPermission:"login:settings:read"},{id:"settings-email",label:"Email & SMTP",icon:m.mail,group:"Configuration",order:1,requiredPermission:"login:settings:read"},{id:"settings-webhooks",label:"Webhooks",icon:m.webhook,group:"Configuration",order:2,requiredPermission:"login:settings:read"},{id:"settings-wallet",label:"User Wallets",icon:m.wallet,group:"Configuration",order:3,requiredPermission:"login:settings:read"},{id:"settings-credits",label:"Credit System",icon:m.coins,group:"Configuration",order:4,requiredPermission:"login:settings:read"},{id:"settings-server",label:"Auth Server",icon:m.server,group:"Configuration",order:5,requiredPermission:"login:settings:read"}],ne={id:"cedros-login",name:"Cedros Login",version:"1.0.0",sections:ie,groups:[{id:"users",label:"Users",order:0},{id:"configuration",label:"Configuration",order:2}],components:{users:H,team:F,deposits:J,withdrawals:K,"settings-auth":Q,"settings-wallet":X,"settings-email":Y,"settings-webhooks":Z,"settings-credits":ee,"settings-server":se},createPluginContext(a){const i=a.cedrosLogin;if(!i)throw new Error("cedros-login plugin requires cedrosLogin in hostContext");return{serverUrl:i.serverUrl,userId:i.user?.id,getAccessToken:i.getAccessToken,hasPermission:r=>this.checkPermission(r,a),orgId:a.org?.orgId,pluginData:{user:i.user,orgRole:a.org?.role}}},checkPermission(a,i){const r=i.org;if(!r)return!!i.cedrosLogin?.user;const c=re[a];return c?c.some(p=>r.permissions.includes(p)||p===r.role||p==="admin"&&["admin","owner"].includes(r.role)||p==="owner"&&r.role==="owner"):!1},cssNamespace:"cedros-dashboard"};exports.AdminShell=G;exports.Icons=m;exports.ProfileDropdown=A;exports.cedrosLoginPlugin=ne;exports.useAdminShell=$;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-BtYBW6JY.cjs","sources":["../src/components/admin/ProfileDropdown.tsx","../src/admin/AdminShell.tsx","../src/admin/icons.tsx","../src/admin/plugin.tsx"],"sourcesContent":["/**\n * Profile Dropdown Component\n *\n * Displays user avatar/name with a dropdown menu for settings and logout.\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\n\nexport interface ProfileDropdownProps {\n /** User's display name */\n name?: string;\n /** User's email */\n email?: string;\n /** User's profile picture URL */\n picture?: string;\n /** Callback when Settings is clicked */\n onSettings?: () => void;\n /** Callback when Logout is clicked */\n onLogout?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n/**\n * Profile dropdown button with settings and logout options.\n *\n * @example\n * ```tsx\n * <ProfileDropdown\n * name={user.name}\n * email={user.email}\n * picture={user.picture}\n * onSettings={() => navigate('/settings')}\n * onLogout={logout}\n * />\n * ```\n */\nexport function ProfileDropdown({\n name,\n email,\n picture,\n onSettings,\n onLogout,\n className = '',\n}: ProfileDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }\n }, [isOpen]);\n\n // Close dropdown on escape key\n useEffect(() => {\n function handleEscape(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const handleSettings = useCallback(() => {\n setIsOpen(false);\n onSettings?.();\n }, [onSettings]);\n\n const handleLogout = useCallback(() => {\n setIsOpen(false);\n onLogout?.();\n }, [onLogout]);\n\n const displayName = name || 'User';\n const initial = (name?.[0] || email?.[0] || '?').toUpperCase();\n\n return (\n <div className={`cedros-profile-dropdown ${className}`} ref={dropdownRef}>\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__trigger\"\n onClick={() => setIsOpen(!isOpen)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n >\n <div className=\"cedros-profile-dropdown__avatar\">\n {picture ? (\n <img\n src={picture}\n alt={displayName}\n className=\"cedros-profile-dropdown__avatar-img\"\n referrerPolicy=\"no-referrer\"\n />\n ) : (\n <span className=\"cedros-profile-dropdown__avatar-placeholder\">{initial}</span>\n )}\n </div>\n <div className=\"cedros-profile-dropdown__info\">\n <span className=\"cedros-profile-dropdown__name\">{displayName}</span>\n {email && <span className=\"cedros-profile-dropdown__email\">{email}</span>}\n </div>\n <svg\n className={`cedros-profile-dropdown__chevron ${isOpen ? 'cedros-profile-dropdown__chevron--open' : ''}`}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"cedros-profile-dropdown__menu\" role=\"menu\">\n {onSettings && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item\"\n onClick={handleSettings}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n Settings\n </button>\n )}\n {onLogout && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger\"\n onClick={handleLogout}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n Log out\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n","/**\n * AdminShell - Unified Admin Dashboard Host\n *\n * A shell component that hosts admin plugins from cedros-login, cedros-pay,\n * or any compatible plugin. Provides unified sidebar navigation and content area.\n *\n * @example\n * ```tsx\n * import { AdminShell } from '@cedros/login-react';\n * import { cedrosLoginPlugin } from '@cedros/login-react';\n * import { cedrosPayPlugin } from '@cedros/pay-react';\n *\n * function AdminPage() {\n * const hostContext = useBuildHostContext();\n * return (\n * <AdminShell\n * plugins={[cedrosLoginPlugin, cedrosPayPlugin]}\n * hostContext={hostContext}\n * />\n * );\n * }\n * ```\n */\n\nimport React, {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n Suspense,\n type ReactNode,\n} from 'react';\nimport type {\n AdminPlugin,\n PluginRegistry,\n HostContext,\n QualifiedSectionId,\n PluginContext,\n ResolvedSection,\n} from './types';\nimport { LoadingSpinner } from '../components/shared/LoadingSpinner';\nimport { ProfileDropdown } from '../components/admin/ProfileDropdown';\nimport { CedrosLoginContext, type CedrosLoginContextValue } from '../context/CedrosLoginContext';\nimport type { AuthUser } from '../types';\n\n// ============================================================================\n// Plugin Registry Implementation\n// ============================================================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private plugins = new Map<string, AdminPlugin>();\n private listeners = new Set<(plugins: AdminPlugin[]) => void>();\n\n register(plugin: AdminPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`Plugin ${plugin.id} already registered, replacing...`);\n }\n this.plugins.set(plugin.id, plugin);\n plugin.onRegister?.(this);\n this.notify();\n }\n\n unregister(pluginId: string): void {\n const plugin = this.plugins.get(pluginId);\n if (plugin) {\n plugin.onUnregister?.();\n this.plugins.delete(pluginId);\n this.notify();\n }\n }\n\n get(pluginId: string): AdminPlugin | undefined {\n return this.plugins.get(pluginId);\n }\n\n getAll(): AdminPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n subscribe(listener: (plugins: AdminPlugin[]) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(): void {\n const plugins = this.getAll();\n this.listeners.forEach((listener) => listener(plugins));\n }\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\ninterface AdminShellContextValue {\n registry: PluginRegistry;\n hostContext: HostContext;\n activeSection: QualifiedSectionId | null;\n setActiveSection: (section: QualifiedSectionId) => void;\n getPluginContext: (pluginId: string) => PluginContext | null;\n}\n\nconst AdminShellContext = createContext<AdminShellContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useAdminShell(): AdminShellContextValue {\n const ctx = useContext(AdminShellContext);\n if (!ctx) throw new Error('useAdminShell must be used within AdminShell');\n return ctx;\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface AdminShellProps {\n /** Dashboard title */\n title?: string;\n /** Plugins to load */\n plugins?: AdminPlugin[];\n /** Host context from parent providers */\n hostContext: HostContext;\n /** Default active section (qualified ID) */\n defaultSection?: QualifiedSectionId;\n /** Page size for lists */\n pageSize?: number;\n /** Refresh interval in ms (0 to disable) */\n refreshInterval?: number;\n /** Callback when section changes */\n onSectionChange?: (section: QualifiedSectionId) => void;\n /** Custom logo/header content */\n logo?: ReactNode;\n /** Additional sidebar footer content */\n sidebarFooter?: ReactNode;\n /** Callback when user clicks Settings in profile dropdown */\n onSettingsClick?: () => void;\n /** Callback when user clicks Logout in profile dropdown */\n onLogoutClick?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n// ============================================================================\n// Group Order Helpers\n// ============================================================================\n\n/** Build a group-label → order map from all registered plugins' groups[] config. */\nfunction buildGroupOrder(plugins: AdminPlugin[]): Map<string, number> {\n const order = new Map<string, number>();\n for (const plugin of plugins) {\n for (const group of plugin.groups ?? []) {\n // Key by label (sections reference groups by display name via section.group).\n // First plugin to declare a group wins; later plugins don't override.\n if (!order.has(group.label)) {\n order.set(group.label, group.order);\n }\n }\n }\n return order;\n}\n\n// ============================================================================\n// AdminShell Component\n// ============================================================================\n\nexport function AdminShell({\n title = 'Admin',\n plugins: initialPlugins = [],\n hostContext,\n defaultSection,\n pageSize = 20,\n refreshInterval = 0,\n onSectionChange,\n logo,\n sidebarFooter,\n onSettingsClick,\n onLogoutClick,\n className = '',\n}: AdminShellProps): React.JSX.Element {\n // Plugin registry\n const [registry] = useState(() => {\n const reg = new PluginRegistryImpl();\n initialPlugins.forEach((p) => reg.register(p));\n return reg;\n });\n\n // Track registered plugins for re-renders\n const [registeredPlugins, setRegisteredPlugins] = useState<AdminPlugin[]>(() =>\n registry.getAll()\n );\n\n useEffect(() => {\n return registry.subscribe(setRegisteredPlugins);\n }, [registry]);\n\n // Aggregate sections from all plugins\n const allSections = useMemo(() => {\n return registeredPlugins.flatMap((plugin) =>\n plugin.sections\n .filter((section) => {\n // Check RBAC permissions (role-based)\n if (section.requiredPermission) {\n if (!plugin.checkPermission(section.requiredPermission, hostContext)) {\n return false;\n }\n }\n // Check dashboard section permissions (owner-configured per role)\n if (hostContext.dashboardPermissions) {\n if (!hostContext.dashboardPermissions.canAccess(section.id)) {\n return false;\n }\n }\n return true;\n })\n .map(\n (section): ResolvedSection => ({\n ...section,\n qualifiedId: `${plugin.id}:${section.id}` as QualifiedSectionId,\n pluginId: plugin.id,\n cssNamespace: plugin.cssNamespace,\n })\n )\n );\n }, [registeredPlugins, hostContext]);\n\n // Active section state\n const [activeSection, setActiveSectionInternal] = useState<QualifiedSectionId | null>(\n () => defaultSection ?? allSections[0]?.qualifiedId ?? null\n );\n\n // Collapsible groups state\n const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());\n\n const toggleGroup = useCallback((groupName: string) => {\n setCollapsedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(groupName)) {\n next.delete(groupName);\n } else {\n next.add(groupName);\n }\n return next;\n });\n }, []);\n\n // Update active section when sections change and current is invalid\n useEffect(() => {\n if (activeSection && !allSections.find((s) => s.qualifiedId === activeSection)) {\n setActiveSectionInternal(allSections[0]?.qualifiedId ?? null);\n }\n }, [allSections, activeSection]);\n\n const setActiveSection = useCallback(\n (section: QualifiedSectionId) => {\n setActiveSectionInternal(section);\n onSectionChange?.(section);\n },\n [onSectionChange]\n );\n\n // Plugin context factory\n const getPluginContext = useCallback(\n (pluginId: string): PluginContext | null => {\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n return plugin.createPluginContext(hostContext);\n },\n [registry, hostContext]\n );\n\n // Group sections by group name, sorted by plugin-defined group order\n const groupedSections = useMemo(() => {\n const groupOrder = buildGroupOrder(registeredPlugins);\n const groups = new Map<string, ResolvedSection[]>();\n\n allSections.forEach((section) => {\n const groupName = section.group ?? 'Menu';\n const existing = groups.get(groupName) ?? [];\n groups.set(groupName, [...existing, section]);\n });\n\n // Sort groups by plugin-defined order (undeclared groups sink to bottom)\n const sortedGroups = Array.from(groups.entries()).sort(([a], [b]) => {\n const orderA = groupOrder.get(a) ?? 99;\n const orderB = groupOrder.get(b) ?? 99;\n return orderA - orderB;\n });\n\n return sortedGroups;\n }, [allSections, registeredPlugins]);\n\n // Get current section's component\n const currentSection = useMemo(() => {\n if (!activeSection) return null;\n const [pluginId, sectionId] = activeSection.split(':') as [string, string];\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n const Component = plugin.components[sectionId];\n if (!Component) return null;\n const pluginContext = plugin.createPluginContext(hostContext);\n return { Component, pluginContext, plugin };\n }, [activeSection, registry, hostContext]);\n\n // Context value\n const contextValue = useMemo<AdminShellContextValue>(\n () => ({\n registry,\n hostContext,\n activeSection,\n setActiveSection,\n getPluginContext,\n }),\n [registry, hostContext, activeSection, setActiveSection, getPluginContext]\n );\n\n // Bridge hostContext.cedrosLogin into CedrosLoginContext so hooks\n // (useOrgs, useAdminDeposits, etc.) work inside AdminShell sections.\n const cedrosLoginContextValue = useMemo<CedrosLoginContextValue | null>(() => {\n const cl = hostContext.cedrosLogin;\n if (!cl) return null;\n const user: AuthUser | null = cl.user\n ? { authMethods: [], emailVerified: false, createdAt: '', updatedAt: '', ...cl.user }\n : null;\n return {\n config: { serverUrl: cl.serverUrl },\n user,\n authState: cl.user ? 'authenticated' : 'unauthenticated',\n error: null,\n logout: async () => {},\n refreshUser: async () => {},\n isModalOpen: false,\n openModal: () => {},\n closeModal: () => {},\n _internal: {\n handleLoginSuccess: () => {},\n getAccessToken: cl.getAccessToken,\n },\n };\n }, [hostContext.cedrosLogin]);\n\n return (\n <AdminShellContext.Provider value={contextValue}>\n <CedrosLoginContext.Provider value={cedrosLoginContextValue}>\n <div className={`cedros-admin cedros-admin-shell ${className || ''}`}>\n {/* Sidebar */}\n <aside className=\"cedros-admin-shell__sidebar\">\n <div className=\"cedros-admin-shell__sidebar-header\">\n {logo ?? (\n <div className=\"cedros-admin-shell__logo\">\n <span className=\"cedros-admin-shell__logo-text\">{title}</span>\n </div>\n )}\n </div>\n\n <nav className=\"cedros-admin-shell__nav\">\n {groupedSections.map(([groupName, sections]) => {\n const isCollapsible = groupName === 'Configuration';\n const isCollapsed = collapsedGroups.has(groupName);\n\n return (\n <div key={groupName} className=\"cedros-admin-shell__nav-group\">\n {isCollapsible ? (\n <button\n type=\"button\"\n className=\"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible\"\n onClick={() => toggleGroup(groupName)}\n aria-expanded={!isCollapsed}\n >\n <span>{groupName}</span>\n <span\n className={`cedros-admin-shell__nav-chevron ${!isCollapsed ? 'cedros-admin-shell__nav-chevron--expanded' : ''}`}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </span>\n </button>\n ) : (\n <span className=\"cedros-admin-shell__nav-label\">{groupName}</span>\n )}\n {(!isCollapsible || !isCollapsed) &&\n sections\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n .map((section) => (\n <button\n key={section.qualifiedId}\n type=\"button\"\n className={`cedros-admin-shell__nav-item ${\n activeSection === section.qualifiedId\n ? 'cedros-admin-shell__nav-item--active'\n : ''\n }`}\n onClick={() => setActiveSection(section.qualifiedId)}\n aria-current={\n activeSection === section.qualifiedId ? 'page' : undefined\n }\n >\n <span className=\"cedros-admin-shell__nav-icon\">{section.icon}</span>\n <span className=\"cedros-admin-shell__nav-text\">{section.label}</span>\n {section.badge && (\n <span className=\"cedros-admin-shell__nav-badge\">{section.badge}</span>\n )}\n </button>\n ))}\n </div>\n );\n })}\n </nav>\n\n {/* User profile dropdown + optional custom footer */}\n {(hostContext.cedrosLogin?.user || sidebarFooter) && (\n <div className=\"cedros-admin-shell__sidebar-footer\">\n {hostContext.cedrosLogin?.user && (\n <ProfileDropdown\n name={hostContext.cedrosLogin.user.name}\n email={hostContext.cedrosLogin.user.email}\n picture={hostContext.cedrosLogin.user.picture}\n onSettings={onSettingsClick}\n onLogout={onLogoutClick}\n />\n )}\n {sidebarFooter}\n </div>\n )}\n </aside>\n\n {/* Main Content */}\n <main className=\"cedros-admin-shell__main\">\n {currentSection ? (\n <Suspense fallback={<LoadingFallback />}>\n <div\n className=\"cedros-admin-shell__section\"\n data-plugin-namespace={currentSection.plugin.cssNamespace}\n >\n <currentSection.Component\n pluginContext={currentSection.pluginContext}\n pageSize={pageSize}\n refreshInterval={refreshInterval}\n />\n </div>\n </Suspense>\n ) : (\n <div className=\"cedros-admin-shell__empty\">\n {allSections.length === 0\n ? 'No plugins loaded'\n : 'Select a section from the sidebar'}\n </div>\n )}\n </main>\n </div>\n </CedrosLoginContext.Provider>\n </AdminShellContext.Provider>\n );\n}\n\n// ============================================================================\n// Helper Components\n// ============================================================================\n\nfunction LoadingFallback(): React.JSX.Element {\n return (\n <div className=\"cedros-admin-shell__loading\">\n <LoadingSpinner />\n <span>Loading...</span>\n </div>\n );\n}\n","/**\n * Admin Dashboard Icons\n *\n * SVG icons for the admin dashboard sidebar and sections.\n * Lucide-style, 24x24 viewBox rendered at 16x16.\n */\n\nimport type { ReactNode } from 'react';\n\nconst iconProps = {\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n};\n\nexport const Icons: Record<string, ReactNode> = {\n users: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n members: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n invites: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n deposits: (\n <svg {...iconProps}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8\" />\n <path d=\"M12 18V6\" />\n </svg>\n ),\n\n withdrawals: (\n <svg {...iconProps}>\n <rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\" />\n <path d=\"M9 22v-4h6v4\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n </svg>\n ),\n\n settings: (\n <svg {...iconProps}>\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ),\n\n wallet: (\n <svg {...iconProps}>\n <path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" />\n </svg>\n ),\n\n chevronRight: (\n <svg {...iconProps}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n ),\n\n // Settings sub-page icons\n key: (\n <svg {...iconProps}>\n <path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\" />\n </svg>\n ),\n\n toggles: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"6\" />\n <circle cx=\"8\" cy=\"12\" r=\"2\" />\n </svg>\n ),\n\n shield: (\n <svg {...iconProps}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n ),\n\n mail: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n webhook: (\n <svg {...iconProps}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n ),\n\n coins: (\n <svg {...iconProps}>\n <circle cx=\"8\" cy=\"8\" r=\"6\" />\n <path d=\"M18.09 10.37A6 6 0 1 1 10.34 18\" />\n <path d=\"M7 6h1v4\" />\n <path d=\"m16.71 13.88.7.71-2.82 2.82\" />\n </svg>\n ),\n\n server: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n ),\n};\n","/**\n * Cedros Login Admin Plugin\n *\n * Exports the cedrosLoginPlugin for use with AdminShell.\n * Provides user management, deposits, withdrawals, and configuration sections.\n */\n\nimport { lazy } from 'react';\nimport type { AdminPlugin, HostContext, PluginContext, AdminSectionConfig } from './types';\nimport { Icons } from './icons';\n\n// ============================================================================\n// Lazy-loaded Section Components\n// ============================================================================\n\nconst UsersSection = lazy(() => import('./sections/UsersSection'));\nconst TeamSection = lazy(() => import('./sections/TeamSection'));\nconst DepositsSection = lazy(() => import('./sections/DepositsSection'));\nconst WithdrawalsSection = lazy(() => import('./sections/WithdrawalsSection'));\nconst AuthenticationSettings = lazy(() => import('./sections/AuthenticationSettings'));\nconst EmbeddedWalletSettings = lazy(() => import('./sections/EmbeddedWalletSettings'));\nconst EmailSettings = lazy(() => import('./sections/EmailSettings'));\nconst WebhookSettings = lazy(() => import('./sections/WebhookSettings'));\nconst CreditSystemSettings = lazy(() => import('./sections/CreditSystemSettings'));\nconst ServerSettings = lazy(() => import('./sections/ServerSettings'));\n\n// ============================================================================\n// Permission Mapping\n// ============================================================================\n\ntype LoginPermission =\n | 'login:users:read'\n | 'login:users:write'\n | 'login:members:read'\n | 'login:members:write'\n | 'login:invites:read'\n | 'login:invites:write'\n | 'login:deposits:read'\n | 'login:deposits:write'\n | 'login:settings:read'\n | 'login:settings:write';\n\n/**\n * Maps plugin permissions to org-level permissions/roles.\n */\nconst PERMISSION_MAP: Record<LoginPermission, string[]> = {\n 'login:users:read': ['admin', 'owner'],\n 'login:users:write': ['admin', 'owner'],\n 'login:members:read': ['member:read', 'admin', 'owner'],\n 'login:members:write': ['member:remove', 'member:role_change'],\n 'login:invites:read': ['invite:read', 'admin', 'owner'],\n 'login:invites:write': ['invite:create', 'invite:cancel'],\n 'login:deposits:read': ['admin', 'owner'],\n 'login:deposits:write': ['admin', 'owner'],\n 'login:settings:read': ['admin', 'owner'],\n 'login:settings:write': ['admin', 'owner'],\n};\n\n// ============================================================================\n// Section Configuration\n// ============================================================================\n\nconst SECTIONS: AdminSectionConfig[] = [\n // Users group (main sections)\n {\n id: 'users',\n label: 'Users',\n icon: Icons.users,\n group: 'Users',\n order: 0,\n requiredPermission: 'login:users:read',\n },\n {\n id: 'team',\n label: 'Team',\n icon: Icons.members,\n group: 'Users',\n order: 1,\n requiredPermission: 'login:members:read',\n },\n {\n id: 'deposits',\n label: 'Deposits',\n icon: Icons.deposits,\n group: 'Users',\n order: 2,\n requiredPermission: 'login:deposits:read',\n },\n {\n id: 'withdrawals',\n label: 'Withdrawals',\n icon: Icons.withdrawals,\n group: 'Users',\n order: 3,\n requiredPermission: 'login:deposits:read',\n },\n\n // Configuration group (settings sections)\n {\n id: 'settings-auth',\n label: 'Authentication',\n icon: Icons.key,\n group: 'Configuration',\n order: 0,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-email',\n label: 'Email & SMTP',\n icon: Icons.mail,\n group: 'Configuration',\n order: 1,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-webhooks',\n label: 'Webhooks',\n icon: Icons.webhook,\n group: 'Configuration',\n order: 2,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-wallet',\n label: 'User Wallets',\n icon: Icons.wallet,\n group: 'Configuration',\n order: 3,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-credits',\n label: 'Credit System',\n icon: Icons.coins,\n group: 'Configuration',\n order: 4,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-server',\n label: 'Auth Server',\n icon: Icons.server,\n group: 'Configuration',\n order: 5,\n requiredPermission: 'login:settings:read',\n },\n];\n\n// ============================================================================\n// Plugin Definition\n// ============================================================================\n\nexport const cedrosLoginPlugin: AdminPlugin = {\n id: 'cedros-login',\n name: 'Cedros Login',\n version: '1.0.0',\n\n sections: SECTIONS,\n\n groups: [\n { id: 'users', label: 'Users', order: 0 },\n { id: 'configuration', label: 'Configuration', order: 2 },\n ],\n\n components: {\n users: UsersSection,\n team: TeamSection,\n deposits: DepositsSection,\n withdrawals: WithdrawalsSection,\n 'settings-auth': AuthenticationSettings,\n 'settings-wallet': EmbeddedWalletSettings,\n 'settings-email': EmailSettings,\n 'settings-webhooks': WebhookSettings,\n 'settings-credits': CreditSystemSettings,\n 'settings-server': ServerSettings,\n },\n\n createPluginContext(hostContext: HostContext): PluginContext {\n const cedrosLogin = hostContext.cedrosLogin;\n if (!cedrosLogin) {\n throw new Error('cedros-login plugin requires cedrosLogin in hostContext');\n }\n\n return {\n serverUrl: cedrosLogin.serverUrl,\n userId: cedrosLogin.user?.id,\n getAccessToken: cedrosLogin.getAccessToken,\n hasPermission: (permission) => this.checkPermission(permission, hostContext),\n orgId: hostContext.org?.orgId,\n pluginData: {\n user: cedrosLogin.user,\n orgRole: hostContext.org?.role,\n },\n };\n },\n\n checkPermission(permission: string, hostContext: HostContext): boolean {\n const org = hostContext.org;\n\n // No org context = admin-level access (for global admins)\n if (!org) {\n // Check if user is in cedrosLogin context - assume admin if present\n return Boolean(hostContext.cedrosLogin?.user);\n }\n\n const requiredPerms = PERMISSION_MAP[permission as LoginPermission];\n if (!requiredPerms) {\n // Unknown permission - default deny\n return false;\n }\n\n // Check if user has any of the required permissions\n return requiredPerms.some(\n (p) =>\n org.permissions.includes(p) ||\n p === org.role ||\n (p === 'admin' && ['admin', 'owner'].includes(org.role)) ||\n (p === 'owner' && org.role === 'owner')\n );\n },\n\n cssNamespace: 'cedros-dashboard',\n};\n\n// Named export for convenience\nexport { cedrosLoginPlugin as loginPlugin };\n"],"names":["ProfileDropdown","name","email","picture","onSettings","onLogout","className","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","handleSettings","useCallback","handleLogout","displayName","initial","jsxs","jsx","PluginRegistryImpl","plugin","pluginId","listener","plugins","AdminShellContext","createContext","useAdminShell","ctx","useContext","buildGroupOrder","order","group","AdminShell","title","initialPlugins","hostContext","defaultSection","pageSize","refreshInterval","onSectionChange","logo","sidebarFooter","onSettingsClick","onLogoutClick","registry","reg","p","registeredPlugins","setRegisteredPlugins","allSections","useMemo","section","activeSection","setActiveSectionInternal","collapsedGroups","setCollapsedGroups","toggleGroup","groupName","prev","next","setActiveSection","getPluginContext","groupedSections","groupOrder","groups","existing","a","b","orderA","orderB","currentSection","sectionId","Component","pluginContext","contextValue","cedrosLoginContextValue","cl","user","CedrosLoginContext","sections","isCollapsible","isCollapsed","Suspense","LoadingFallback","LoadingSpinner","iconProps","Icons","UsersSection","lazy","TeamSection","DepositsSection","WithdrawalsSection","AuthenticationSettings","EmbeddedWalletSettings","EmailSettings","WebhookSettings","CreditSystemSettings","ServerSettings","PERMISSION_MAP","SECTIONS","cedrosLoginPlugin","cedrosLogin","permission","org","requiredPerms"],"mappings":"gHAqCO,SAASA,EAAgB,CAC9B,KAAAC,EACA,MAAAC,EACA,Q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iC,CAC5C,GAAI,eACJ,KAAM,eACN,QAAS,QAET,SAAUD,GAEV,OAAQ,CACN,CAAE,GAAI,QAAS,MAAO,QAAS,MAAO,CAAA,EACtC,CAAE,GAAI,gBAAiB,MAAO,gBAAiB,MAAO,CAAA,CAAE,EAG1D,WAAY,CACV,MAAOZ,EACP,KAAME,EACN,SAAUC,EACV,YAAaC,EACb,gBAAiBC,EACjB,kBAAmBC,EACnB,iBAAkBC,EAClB,oBAAqBC,EACrB,mBAAoBC,GACpB,kBAAmBC,EAAA,EAGrB,oBAAoB9D,EAAyC,CAC3D,MAAMkE,EAAclE,EAAY,YAChC,GAAI,CAACkE,EACH,MAAM,IAAI,MAAM,yDAAyD,EAG3E,MAAO,CACL,UAAWA,EAAY,UACvB,OAAQA,EAAY,MAAM,GAC1B,eAAgBA,EAAY,eAC5B,cAAgBC,GAAe,KAAK,gBAAgBA,EAAYnE,CAAW,EAC3E,MAAOA,EAAY,KAAK,MACxB,WAAY,CACV,KAAMkE,EAAY,KAClB,QAASlE,EAAY,KAAK,IAAA,CAC5B,CAEJ,EAEA,gBAAgBmE,EAAoBnE,EAAmC,CACrE,MAAMoE,EAAMpE,EAAY,IAGxB,GAAI,CAACoE,EAEH,MAAO,EAAQpE,EAAY,aAAa,KAG1C,MAAMqE,EAAgBN,GAAeI,CAA6B,EAClE,OAAKE,EAMEA,EAAc,KAClB,GACCD,EAAI,YAAY,SAAS,CAAC,GAC1B,IAAMA,EAAI,MACT,IAAM,SAAW,CAAC,QAAS,OAAO,EAAE,SAASA,EAAI,IAAI,GACrD,IAAM,SAAWA,EAAI,OAAS,OAAA,EAT1B,EAWX,EAEA,aAAc,kBAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=["https:"],e=["javascript:","data:","vbscript:","file:"];function s(o){if(!o||typeof o!="string")return;const t=o.trim();if(!t)return;const i=t.toLowerCase();for(const r of e)if(i.startsWith(r))return;try{const r=new URL(t);return n.includes(r.protocol)?t:void 0}catch{return}}function c(o){if(!o||typeof o!="string")return;const t=o.trim();if(!t)return;const i=t.toLowerCase();for(const r of e)if(i.startsWith(r))return;try{const r=new URL(t);return r.protocol!=="https:"&&r.protocol!=="http:"?void 0:t}catch{return}}exports.sanitizeExternalUrl=c;exports.sanitizeImageUrl=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitization-Bo_tn-L2.cjs","sources":["../src/utils/sanitization.ts"],"sourcesContent":["/**\n * Input sanitization utilities for security\n */\n\n/**\n * Allowed image URL protocols\n */\nconst SAFE_PROTOCOLS = ['https:'];\n\n/**\n * Dangerous protocols that should never be allowed\n */\nconst DANGEROUS_PROTOCOLS = ['javascript:', 'data:', 'vbscript:', 'file:'];\n\n/**\n * Sanitizes an image URL to prevent XSS and other attacks.\n *\n * ## Security Properties\n *\n * - Only allows HTTPS URLs (prevents protocol-based attacks)\n * - Blocks javascript:, data:, vbscript:, file: protocols\n * - Returns undefined for invalid URLs\n *\n * ## Limitations (S-20/SEC-08)\n *\n * This function validates the URL protocol but does NOT validate the domain.\n * Any HTTPS URL will pass validation, including URLs from untrusted domains.\n * This is intentional - domain allowlisting is application-specific and should\n * be implemented at the consumer level (see example below).\n *\n * If your application requires domain validation (e.g., only allowing images\n * from trusted CDNs), implement additional validation:\n *\n * @example Domain allowlisting (application-level)\n * ```ts\n * const ALLOWED_DOMAINS = ['cdn.example.com', 'images.trusted.org'];\n *\n * function isAllowedImageUrl(url: string): boolean {\n * const sanitized = sanitizeImageUrl(url);\n * if (!sanitized) return false;\n *\n * try {\n * const hostname = new URL(sanitized).hostname;\n * return ALLOWED_DOMAINS.some(d => hostname === d || hostname.endsWith('.' + d));\n * } catch {\n * return false;\n * }\n * }\n * ```\n *\n * @param url - The URL to sanitize\n * @returns The sanitized URL or undefined if invalid\n *\n * @example Basic usage\n * ```ts\n * sanitizeImageUrl('https://example.com/avatar.png') // 'https://example.com/avatar.png'\n * sanitizeImageUrl('javascript:alert(1)') // undefined\n * sanitizeImageUrl('data:image/svg+xml,...') // undefined\n * ```\n */\nexport function sanitizeImageUrl(url: string | undefined | null): string | undefined {\n if (!url || typeof url !== 'string') {\n return undefined;\n }\n\n // Trim whitespace\n const trimmedUrl = url.trim();\n if (!trimmedUrl) {\n return undefined;\n }\n\n // Check for dangerous protocols (case-insensitive)\n const lowerUrl = trimmedUrl.toLowerCase();\n for (const protocol of DANGEROUS_PROTOCOLS) {\n if (lowerUrl.startsWith(protocol)) {\n return undefined;\n }\n }\n\n // Try to parse as URL\n try {\n const parsed = new URL(trimmedUrl);\n\n // Only allow safe protocols\n if (!SAFE_PROTOCOLS.includes(parsed.protocol)) {\n return undefined;\n }\n\n // Return the original URL (preserves case)\n return trimmedUrl;\n } catch {\n // Invalid URL\n return undefined;\n }\n}\n\n/**\n * Sanitizes an external link URL for use in href attributes.\n *\n * Security goals:\n * - Block dangerous protocols (javascript:, data:, vbscript:, file:)\n * - Only allow http/https absolute URLs\n */\nexport function sanitizeExternalUrl(url: string | undefined | null): string | undefined {\n if (!url || typeof url !== 'string') {\n return undefined;\n }\n\n const trimmedUrl = url.trim();\n if (!trimmedUrl) {\n return undefined;\n }\n\n const lowerUrl = trimmedUrl.toLowerCase();\n for (const protocol of DANGEROUS_PROTOCOLS) {\n if (lowerUrl.startsWith(protocol)) {\n return undefined;\n }\n }\n\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {\n return undefined;\n }\n return trimmedUrl;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Sanitizes user-provided text to prevent XSS in text content.\n * Escapes HTML special characters.\n *\n * @param text - The text to sanitize\n * @returns The sanitized text\n */\nexport function sanitizeText(text: string | undefined | null): string {\n if (!text || typeof text !== 'string') {\n return '';\n }\n\n return text\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n"],"names":["SAFE_PROTOCOLS","DANGEROUS_PROTOCOLS","sanitizeImageUrl","url","trimmedUrl","lowerUrl","protocol","parsed","sanitizeExternalUrl"],"mappings":"aAOA,MAAMA,EAAiB,CAAC,QAAQ,EAK1BC,EAAsB,CAAC,cAAe,QAAS,YAAa,OAAO,EAgDlE,SAASC,EAAiBC,EAAoD,CACnF,GAAI,CAACA,GAAO,OAAOA,GAAQ,SACzB,OAIF,MAAMC,EAAaD,EAAI,KAAA,EACvB,GAAI,CAACC,EACH,OAIF,MAAMC,EAAWD,EAAW,YAAA,EAC5B,UAAWE,KAAYL,EACrB,GAAII,EAAS,WAAWC,CAAQ,EAC9B,OAKJ,GAAI,CACF,MAAMC,EAAS,IAAI,IAAIH,CAAU,EAGjC,OAAKJ,EAAe,SAASO,EAAO,QAAQ,EAKrCH,EAJL,MAKJ,MAAQ,CAEN,MACF,CACF,CASO,SAASI,EAAoBL,EAAoD,CACtF,GAAI,CAACA,GAAO,OAAOA,GAAQ,SACzB,OAGF,MAAMC,EAAaD,EAAI,KAAA,EACvB,GAAI,CAACC,EACH,OAGF,MAAMC,EAAWD,EAAW,YAAA,EAC5B,UAAWE,KAAYL,EACrB,GAAII,EAAS,WAAWC,CAAQ,EAC9B,OAIJ,GAAI,CACF,MAAMC,EAAS,IAAI,IAAIH,CAAU,EACjC,OAAIG,EAAO,WAAa,UAAYA,EAAO,WAAa,QACtD,OAEKH,CACT,MAAQ,CACN,MACF,CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const e = ["https:"], n = ["javascript:", "data:", "vbscript:", "file:"];
|
|
2
|
+
function s(o) {
|
|
3
|
+
if (!o || typeof o != "string")
|
|
4
|
+
return;
|
|
5
|
+
const t = o.trim();
|
|
6
|
+
if (!t)
|
|
7
|
+
return;
|
|
8
|
+
const i = t.toLowerCase();
|
|
9
|
+
for (const r of n)
|
|
10
|
+
if (i.startsWith(r))
|
|
11
|
+
return;
|
|
12
|
+
try {
|
|
13
|
+
const r = new URL(t);
|
|
14
|
+
return e.includes(r.protocol) ? t : void 0;
|
|
15
|
+
} catch {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function c(o) {
|
|
20
|
+
if (!o || typeof o != "string")
|
|
21
|
+
return;
|
|
22
|
+
const t = o.trim();
|
|
23
|
+
if (!t)
|
|
24
|
+
return;
|
|
25
|
+
const i = t.toLowerCase();
|
|
26
|
+
for (const r of n)
|
|
27
|
+
if (i.startsWith(r))
|
|
28
|
+
return;
|
|
29
|
+
try {
|
|
30
|
+
const r = new URL(t);
|
|
31
|
+
return r.protocol !== "https:" && r.protocol !== "http:" ? void 0 : t;
|
|
32
|
+
} catch {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
s as a,
|
|
38
|
+
c as s
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitization-CQ-H1MSg.js","sources":["../src/utils/sanitization.ts"],"sourcesContent":["/**\n * Input sanitization utilities for security\n */\n\n/**\n * Allowed image URL protocols\n */\nconst SAFE_PROTOCOLS = ['https:'];\n\n/**\n * Dangerous protocols that should never be allowed\n */\nconst DANGEROUS_PROTOCOLS = ['javascript:', 'data:', 'vbscript:', 'file:'];\n\n/**\n * Sanitizes an image URL to prevent XSS and other attacks.\n *\n * ## Security Properties\n *\n * - Only allows HTTPS URLs (prevents protocol-based attacks)\n * - Blocks javascript:, data:, vbscript:, file: protocols\n * - Returns undefined for invalid URLs\n *\n * ## Limitations (S-20/SEC-08)\n *\n * This function validates the URL protocol but does NOT validate the domain.\n * Any HTTPS URL will pass validation, including URLs from untrusted domains.\n * This is intentional - domain allowlisting is application-specific and should\n * be implemented at the consumer level (see example below).\n *\n * If your application requires domain validation (e.g., only allowing images\n * from trusted CDNs), implement additional validation:\n *\n * @example Domain allowlisting (application-level)\n * ```ts\n * const ALLOWED_DOMAINS = ['cdn.example.com', 'images.trusted.org'];\n *\n * function isAllowedImageUrl(url: string): boolean {\n * const sanitized = sanitizeImageUrl(url);\n * if (!sanitized) return false;\n *\n * try {\n * const hostname = new URL(sanitized).hostname;\n * return ALLOWED_DOMAINS.some(d => hostname === d || hostname.endsWith('.' + d));\n * } catch {\n * return false;\n * }\n * }\n * ```\n *\n * @param url - The URL to sanitize\n * @returns The sanitized URL or undefined if invalid\n *\n * @example Basic usage\n * ```ts\n * sanitizeImageUrl('https://example.com/avatar.png') // 'https://example.com/avatar.png'\n * sanitizeImageUrl('javascript:alert(1)') // undefined\n * sanitizeImageUrl('data:image/svg+xml,...') // undefined\n * ```\n */\nexport function sanitizeImageUrl(url: string | undefined | null): string | undefined {\n if (!url || typeof url !== 'string') {\n return undefined;\n }\n\n // Trim whitespace\n const trimmedUrl = url.trim();\n if (!trimmedUrl) {\n return undefined;\n }\n\n // Check for dangerous protocols (case-insensitive)\n const lowerUrl = trimmedUrl.toLowerCase();\n for (const protocol of DANGEROUS_PROTOCOLS) {\n if (lowerUrl.startsWith(protocol)) {\n return undefined;\n }\n }\n\n // Try to parse as URL\n try {\n const parsed = new URL(trimmedUrl);\n\n // Only allow safe protocols\n if (!SAFE_PROTOCOLS.includes(parsed.protocol)) {\n return undefined;\n }\n\n // Return the original URL (preserves case)\n return trimmedUrl;\n } catch {\n // Invalid URL\n return undefined;\n }\n}\n\n/**\n * Sanitizes an external link URL for use in href attributes.\n *\n * Security goals:\n * - Block dangerous protocols (javascript:, data:, vbscript:, file:)\n * - Only allow http/https absolute URLs\n */\nexport function sanitizeExternalUrl(url: string | undefined | null): string | undefined {\n if (!url || typeof url !== 'string') {\n return undefined;\n }\n\n const trimmedUrl = url.trim();\n if (!trimmedUrl) {\n return undefined;\n }\n\n const lowerUrl = trimmedUrl.toLowerCase();\n for (const protocol of DANGEROUS_PROTOCOLS) {\n if (lowerUrl.startsWith(protocol)) {\n return undefined;\n }\n }\n\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {\n return undefined;\n }\n return trimmedUrl;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Sanitizes user-provided text to prevent XSS in text content.\n * Escapes HTML special characters.\n *\n * @param text - The text to sanitize\n * @returns The sanitized text\n */\nexport function sanitizeText(text: string | undefined | null): string {\n if (!text || typeof text !== 'string') {\n return '';\n }\n\n return text\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n"],"names":["SAFE_PROTOCOLS","DANGEROUS_PROTOCOLS","sanitizeImageUrl","url","trimmedUrl","lowerUrl","protocol","parsed","sanitizeExternalUrl"],"mappings":"AAOA,MAAMA,IAAiB,CAAC,QAAQ,GAK1BC,IAAsB,CAAC,eAAe,SAAS,aAAa,OAAO;AAgDlE,SAASC,EAAiBC,GAAoD;AACnF,MAAI,CAACA,KAAO,OAAOA,KAAQ;AACzB;AAIF,QAAMC,IAAaD,EAAI,KAAA;AACvB,MAAI,CAACC;AACH;AAIF,QAAMC,IAAWD,EAAW,YAAA;AAC5B,aAAWE,KAAYL;AACrB,QAAII,EAAS,WAAWC,CAAQ;AAC9B;AAKJ,MAAI;AACF,UAAMC,IAAS,IAAI,IAAIH,CAAU;AAGjC,WAAKJ,EAAe,SAASO,EAAO,QAAQ,IAKrCH,IAJL;AAAA,EAKJ,QAAQ;AAEN;AAAA,EACF;AACF;AASO,SAASI,EAAoBL,GAAoD;AACtF,MAAI,CAACA,KAAO,OAAOA,KAAQ;AACzB;AAGF,QAAMC,IAAaD,EAAI,KAAA;AACvB,MAAI,CAACC;AACH;AAGF,QAAMC,IAAWD,EAAW,YAAA;AAC5B,aAAWE,KAAYL;AACrB,QAAII,EAAS,WAAWC,CAAQ;AAC9B;AAIJ,MAAI;AACF,UAAMC,IAAS,IAAI,IAAIH,CAAU;AACjC,WAAIG,EAAO,aAAa,YAAYA,EAAO,aAAa,UACtD,SAEKH;AAAA,EACT,QAAQ;AACN;AAAA,EACF;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const K=require("./useAuth-DhIDTLRd.cjs");var dt=typeof document<"u"?document.currentScript:null;let F=null,ve=0;const nt=new Map;function Re(){return typeof Worker>"u"?null:(F||(F=new Worker(new URL(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/argon2Worker-Bi5TuQvD.js").href:new URL("assets/argon2Worker-Bi5TuQvD.js",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),typeof document>"u"?require("url").pathToFileURL(__filename).href:dt&&dt.tagName.toUpperCase()==="SCRIPT"&&dt.src||new URL("shamir-AeLLfw0p.cjs",document.baseURI).href),{type:"module"}),F.onmessage=e=>{const{id:t,key:n,error:o}=e.data,r=nt.get(t);if(r){if(nt.delete(t),o){r.reject(new Error(o));return}if(!n){r.reject(new Error("Argon2 worker returned no key"));return}r.resolve(n)}},F.onerror=e=>{const t=e instanceof ErrorEvent?e.error:new Error("Argon2 worker error");for(const n of nt.values())n.reject(t instanceof Error?t:new Error(String(t)));nt.clear(),F?.terminate(),F=null}),F)}async function Ae(e,t,n=K.DEFAULT_KDF_PARAMS){K.validateKdfParams(n);const o=Re();return o?new Promise((r,s)=>{const c=ve++;nt.set(c,{resolve:r,reject:s});const u={id:c,password:e,salt:t,params:n};o.postMessage(u)}):K.argon2Derive(e,t,n)}function ne(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ie(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function o(){var r=!1;try{r=this instanceof o}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}),n}var ct={exports:{}};const _e=globalThis.crypto,Ne=globalThis.crypto,Te=globalThis.crypto.subtle,Oe=globalThis.crypto.getRandomValues.bind(globalThis.crypto),Ce=globalThis.crypto.randomUUID.bind(globalThis.crypto),Le=Object.freeze(Object.defineProperty({__proto__:null,default:_e,getRandomValues:Oe,randomUUID:Ce,subtle:Te,webcrypto:Ne},Symbol.toStringTag,{value:"Module"})),Ue=Ie(Le);var He=ct.exports,Dt;function De(){return Dt||(Dt=1,(function(e,t){(function(n,o){e.exports=o(Ue)})(He,function(n){var o,r,s,c,u;function i(){o={bits:8,radix:16,minBits:3,maxBits:20,bytesPerChar:2,maxBytesPerChar:6,primitivePolynomials:[null,null,1,3,3,5,3,3,29,17,9,5,83,27,43,3,45,9,39,39,9,5,3,33,27,9,71,39,9,5,83]},r={},s=new Array(1024).join("0"),c=!0,u=["nodeCryptoRandomBytes","browserCryptoGetRandomValues","testRandom"]}function x(){return!!(r&&r.rng&&typeof r.rng=="function")}function y(a,h){var f;if(h===0||h===1)return a;if(h&&h>1024)throw new Error("Padding must be multiples of no larger than 1024 bits.");return h=h||r.bits,a&&(f=a.length%h),f?(s+a).slice(-(h-f+a.length)):a}function w(a){var h="",f,l;for(l=a.length-1;l>=0;l--){if(f=parseInt(a[l],16),isNaN(f))throw new Error("Invalid hex character.");h=y(f.toString(2),4)+h}return h}function S(a){var h="",f,l;for(a=y(a,4),l=a.length;l>=4;l-=4){if(f=parseInt(a.slice(l-4,l),2),isNaN(f))throw new Error("Invalid binary character.");h=f.toString(16)+h}return h}function I(){return!!(n&&typeof n=="object"&&(typeof n.getRandomValues=="function"||typeof n.getRandomValues=="object")&&(typeof Uint32Array=="function"||typeof Uint32Array=="object"))}function v(){return typeof n=="object"&&typeof n.randomBytes=="function"}function T(a){function h(b,g,m,B){var A=0,C,L="",q;for(g&&(C=g.length-1);A<C||L.length<b;)q=Math.abs(parseInt(g[A],m)),L=L+y(q.toString(2),B),A++;return L=L.substr(-b),(L.match(/0/g)||[]).length===L.length?null:L}function f(b){var g,m,B,A,C=null;for(B=16,A=4,m=Math.ceil(b/8);C===null;)g=n.randomBytes(m),C=h(b,g.toString("hex"),B,A);return C}function l(b){var g,m,B,A=null;for(m=10,B=32,g=Math.ceil(b/32);A===null;)A=h(b,n.getRandomValues(new Uint32Array(g)),m,B);return A}function d(b){var g,m,B,A,C,L=null;A=10,C=32,m=Math.ceil(b/32),B=123456789,g=new Uint32Array(m);for(var q=0;q<g.length;q++)g[q]=B;for(;L===null;)L=h(b,g,A,C);return L}if(a&&a==="testRandom")return r.typeCSPRNG=a,d;if(a&&a==="nodeCryptoRandomBytes")return r.typeCSPRNG=a,f;if(a&&a==="browserCryptoGetRandomValues")return r.typeCSPRNG=a,l;if(v())return r.typeCSPRNG="nodeCryptoRandomBytes",f;if(I())return r.typeCSPRNG="browserCryptoGetRandomValues",l}function _(a,h){var f=[],l;for(h&&(a=y(a,h)),l=a.length;l>r.bits;l-=r.bits)f.push(parseInt(a.slice(l-r.bits,l),2));return f.push(parseInt(a.slice(0,l),2)),f}function E(a,h){var f=r.logs[a],l=0,d;for(d=h.length-1;d>=0;d--)l!==0?l=r.exps[(f+r.logs[l])%r.maxShares]^h[d]:l=h[d];return l}function R(a,h,f){var l=0,d,b,g,m;for(g=0,d=h.length;g<d;g++)if(f[g]){for(b=r.logs[f[g]],m=0;m<d;m++)if(g!==m){if(a===h[m]){b=-1;break}b=(b+r.logs[a^h[m]]-r.logs[h[g]^h[m]]+r.maxShares)%r.maxShares}l=b===-1?l:l^r.exps[b]}return l}function p(a,h,f){var l=[],d=[a],b,g;for(b=1;b<f;b++)d[b]=parseInt(r.rng(r.bits),2);for(b=1,g=h+1;b<g;b++)l[b-1]={x:b,y:E(b,d)};return l}function N(a,h,f){var l,d,b,g,m;if(h=parseInt(h,r.radix),a=parseInt(a,10)||r.bits,l=a.toString(36).toUpperCase(),b=Math.pow(2,a)-1,g=b.toString(r.radix).length,d=y(h.toString(r.radix),g),typeof h!="number"||h%1!==0||h<1||h>b)throw new Error("Share id must be an integer between 1 and "+b+", inclusive.");return m=l+d+f,m}var O={init:function(a,h){var f=[],l=[],d=1,b,g;if(i(),a&&(typeof a!="number"||a%1!==0||a<o.minBits||a>o.maxBits))throw new Error("Number of bits must be an integer between "+o.minBits+" and "+o.maxBits+", inclusive.");if(h&&u.indexOf(h)===-1)throw new Error("Invalid RNG type argument : '"+h+"'");for(r.radix=o.radix,r.bits=a||o.bits,r.size=Math.pow(2,r.bits),r.maxShares=r.size-1,b=o.primitivePolynomials[r.bits],g=0;g<r.size;g++)l[g]=d,f[d]=g,d=d<<1,d>=r.size&&(d=d^b,d=d&r.maxShares);if(r.logs=f,r.exps=l,h&&this.setRNG(h),x()||this.setRNG(),!x()||!r.bits||!r.size||!r.maxShares||!r.logs||!r.exps||r.logs.length!==r.size||r.exps.length!==r.size)throw new Error("Initialization failed.")},combine:function(a,h){var f,l,d,b,g="",m,B,A,C=[],L=[];for(h=h||0,f=0,d=a.length;f<d;f++){if(B=this.extractShareComponents(a[f]),m===void 0)m=B.bits;else if(B.bits!==m)throw new Error("Mismatched shares: Different bit settings.");if(r.bits!==m&&this.init(m),C.indexOf(B.id)===-1)for(C.push(B.id),A=_(w(B.data)),l=0,b=A.length;l<b;l++)L[l]=L[l]||[],L[l][C.length-1]=A[l]}for(f=0,d=L.length;f<d;f++)g=y(R(h,C,L[f]).toString(2))+g;return S(h>=1?g:g.slice(g.indexOf("1")+1))},getConfig:function(){var a={};return a.radix=r.radix,a.bits=r.bits,a.maxShares=r.maxShares,a.hasCSPRNG=x(),a.typeCSPRNG=r.typeCSPRNG,a},extractShareComponents:function(a){var h,f,l,d,b={},g,m;if(h=parseInt(a.substr(0,1),36),h&&(typeof h!="number"||h%1!==0||h<o.minBits||h>o.maxBits))throw new Error("Invalid share : Number of bits must be an integer between "+o.minBits+" and "+o.maxBits+", inclusive.");if(d=Math.pow(2,h)-1,l=(Math.pow(2,h)-1).toString(r.radix).length,g="^([a-kA-K3-9]{1})([a-fA-F0-9]{"+l+"})([a-fA-F0-9]+)$",m=new RegExp(g).exec(a),m&&(f=parseInt(m[2],r.radix)),typeof f!="number"||f%1!==0||f<1||f>d)throw new Error("Invalid share : Share id must be an integer between 1 and "+r.maxShares+", inclusive.");if(m&&m[3])return b.bits=h,b.id=f,b.data=m[3],b;throw new Error("The share data provided is invalid : "+a)},setRNG:function(a){var h="Random number generator is invalid ",f=" Supply an CSPRNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.";if(a&&typeof a=="string"&&u.indexOf(a)===-1)throw new Error("Invalid RNG type argument : '"+a+"'");if(a||(a=T()),a&&typeof a=="string"&&(a=T(a)),c){if(a&&typeof a!="function")throw new Error(h+"(Not a function)."+f);if(a&&typeof a(r.bits)!="string")throw new Error(h+"(Output is not a string)."+f);if(a&&!parseInt(a(r.bits),2))throw new Error(h+"(Binary string output not parseable to an Integer)."+f);if(a&&a(r.bits).length>r.bits)throw new Error(h+"(Output length is greater than config.bits)."+f);if(a&&a(r.bits).length<r.bits)throw new Error(h+"(Output length is less than config.bits)."+f)}return r.rng=a,!0},str2hex:function(a,h){var f,l,d="",b,g,m,B;if(typeof a!="string")throw new Error("Input must be a character string.");if(h||(h=o.bytesPerChar),typeof h!="number"||h<1||h>o.maxBytesPerChar||h%1!==0)throw new Error("Bytes per character must be an integer between 1 and "+o.maxBytesPerChar+", inclusive.");for(f=2*h,l=Math.pow(16,f)-1,m=0,B=a.length;m<B;m++){if(g=a[m].charCodeAt(),isNaN(g))throw new Error("Invalid character: "+a[m]);if(g>l)throw b=Math.ceil(Math.log(g+1)/Math.log(256)),new Error("Invalid character code ("+g+"). Maximum allowable is 256^bytes-1 ("+l+"). To convert this character, use at least "+b+" bytes.");d=y(g.toString(16),f)+d}return d},hex2str:function(a,h){var f,l="",d,b;if(typeof a!="string")throw new Error("Input must be a hexadecimal string.");if(h=h||o.bytesPerChar,typeof h!="number"||h%1!==0||h<1||h>o.maxBytesPerChar)throw new Error("Bytes per character must be an integer between 1 and "+o.maxBytesPerChar+", inclusive.");for(f=2*h,a=y(a,f),d=0,b=a.length;d<b;d+=f)l=String.fromCharCode(parseInt(a.slice(d,d+f),16))+l;return l},random:function(a){if(typeof a!="number"||a%1!==0||a<2||a>65536)throw new Error("Number of bits must be an Integer between 1 and 65536.");return S(r.rng(a))},share:function(a,h,f,l){var d,b,g=new Array(h),m=new Array(h),B,A,C;if(l=l||128,typeof a!="string")throw new Error("Secret must be a string.");if(typeof h!="number"||h%1!==0||h<2)throw new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive.");if(h>r.maxShares)throw d=Math.ceil(Math.log(h+1)/Math.LN2),new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive. To create "+h+" shares, use at least "+d+" bits.");if(typeof f!="number"||f%1!==0||f<2)throw new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive.");if(f>r.maxShares)throw d=Math.ceil(Math.log(f+1)/Math.LN2),new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+r.maxShares+"), inclusive. To use a threshold of "+f+", use at least "+d+" bits.");if(f>h)throw new Error("Threshold number of shares was "+f+" but must be less than or equal to the "+h+" shares specified as the total to generate.");if(typeof l!="number"||l%1!==0||l<0||l>1024)throw new Error("Zero-pad length must be an integer between 0 and 1024 inclusive.");for(a="1"+w(a),a=_(a,l),B=0,C=a.length;B<C;B++)for(b=p(a[B],h,f),A=0;A<h;A++)g[A]=g[A]||b[A].x.toString(r.radix),m[A]=y(b[A].y.toString(2))+(m[A]||"");for(B=0;B<h;B++)g[B]=N(r.bits,g[B],S(m[B]));return g},newShare:function(a,h){var f,l;if(a&&typeof a=="string"&&(a=parseInt(a,r.radix)),l=a.toString(r.radix),a&&l&&h&&h[0])return f=this.extractShareComponents(h[0]),N(f.bits,l,this.combine(h,a));throw new Error("Invalid 'id' or 'shares' Array argument to newShare().")},_reset:i,_padLeft:y,_hex2bin:w,_bin2hex:S,_hasCryptoGetRandomValues:I,_hasCryptoRandomBytes:v,_getRNG:T,_isSetRNG:x,_splitNumStringToIntArray:_,_horner:E,_lagrange:R,_getShares:p,_constructPublicShareString:N};return O.init(),O})})(ct)),ct.exports}var qe=De();const re=ne(qe);function oe(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function _t(e,t=""){if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function D(e,t,n=""){const o=oe(e),r=e?.length,s=t!==void 0;if(!o||s&&r!==t){const c=n&&`"${n}" `,u=s?` of length ${t}`:"",i=o?`length=${r}`:`type=${typeof e}`;throw new Error(c+"expected Uint8Array"+u+", got "+i)}return e}function qt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Me(e,t){D(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function Bt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function bt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const se=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ge=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Nt(e){if(D(e),se)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Ge[e[n]];return t}const V={_0:48,_9:57,A:65,F:70,a:97,f:102};function Mt(e){if(e>=V._0&&e<=V._9)return e-V._0;if(e>=V.A&&e<=V.F)return e-(V.A-10);if(e>=V.a&&e<=V.f)return e-(V.a-10)}function ie(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(se)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const o=new Uint8Array(n);for(let r=0,s=0;r<n;r++,s+=2){const c=Mt(e.charCodeAt(s)),u=Mt(e.charCodeAt(s+1));if(c===void 0||u===void 0){const i=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+i+'" at index '+s)}o[r]=c*16+u}return o}function Gt(...e){let t=0;for(let o=0;o<e.length;o++){const r=e[o];D(r),t+=r.length}const n=new Uint8Array(t);for(let o=0,r=0;o<e.length;o++){const s=e[o];n.set(s,r),r+=s.length}return n}function $e(e,t={}){const n=(r,s)=>e(s).update(r).digest(),o=e(void 0);return n.outputLen=o.outputLen,n.blockLen=o.blockLen,n.create=r=>e(r),Object.assign(n,t),Object.freeze(n)}function Ze(e=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}const je=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});let Ve=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,o,r){this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=r,this.buffer=new Uint8Array(t),this.view=bt(this.buffer)}update(t){qt(this),D(t);const{view:n,buffer:o,blockLen:r}=this,s=t.length;for(let c=0;c<s;){const u=Math.min(r-this.pos,s-c);if(u===r){const i=bt(t);for(;r<=s-c;c+=r)this.process(i,c);continue}o.set(t.subarray(c,c+u),this.pos),this.pos+=u,c+=u,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){qt(this),Me(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:r,isLE:s}=this;let{pos:c}=this;n[c++]=128,Bt(this.buffer.subarray(c)),this.padOffset>r-c&&(this.process(o,0),c=0);for(let w=c;w<r;w++)n[w]=0;o.setBigUint64(r-8,BigInt(this.length*8),s),this.process(o,0);const u=bt(t),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const x=i/4,y=this.get();if(x>y.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<x;w++)u.setUint32(4*w,y[w],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:n,buffer:o,length:r,finished:s,destroyed:c,pos:u}=this;return t.destroyed=c,t.finished=s,t.length=r,t.pos=u,r%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}};const M=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ot=BigInt(2**32-1),$t=BigInt(32);function ke(e,t=!1){return t?{h:Number(e&ot),l:Number(e>>$t&ot)}:{h:Number(e>>$t&ot)|0,l:Number(e&ot)|0}}function Ke(e,t=!1){const n=e.length;let o=new Uint32Array(n),r=new Uint32Array(n);for(let s=0;s<n;s++){const{h:c,l:u}=ke(e[s],t);[o[s],r[s]]=[c,u]}return[o,r]}const Zt=(e,t,n)=>e>>>n,jt=(e,t,n)=>e<<32-n|t>>>n,tt=(e,t,n)=>e>>>n|t<<32-n,et=(e,t,n)=>e<<32-n|t>>>n,st=(e,t,n)=>e<<64-n|t>>>n-32,it=(e,t,n)=>e>>>n-32|t<<64-n;function k(e,t,n,o){const r=(t>>>0)+(o>>>0);return{h:e+n+(r/2**32|0)|0,l:r|0}}const Ye=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),ze=(e,t,n,o)=>t+n+o+(e/2**32|0)|0,We=(e,t,n,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),Xe=(e,t,n,o,r)=>t+n+o+r+(e/2**32|0)|0,Pe=(e,t,n,o,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0)+(r>>>0),Fe=(e,t,n,o,r,s)=>t+n+o+r+s+(e/2**32|0)|0,ce=Ke(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Qe=ce[0],Je=ce[1],Y=new Uint32Array(80),z=new Uint32Array(80);class tn extends Ve{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:n,Bh:o,Bl:r,Ch:s,Cl:c,Dh:u,Dl:i,Eh:x,El:y,Fh:w,Fl:S,Gh:I,Gl:v,Hh:T,Hl:_}=this;return[t,n,o,r,s,c,u,i,x,y,w,S,I,v,T,_]}set(t,n,o,r,s,c,u,i,x,y,w,S,I,v,T,_){this.Ah=t|0,this.Al=n|0,this.Bh=o|0,this.Bl=r|0,this.Ch=s|0,this.Cl=c|0,this.Dh=u|0,this.Dl=i|0,this.Eh=x|0,this.El=y|0,this.Fh=w|0,this.Fl=S|0,this.Gh=I|0,this.Gl=v|0,this.Hh=T|0,this.Hl=_|0}process(t,n){for(let p=0;p<16;p++,n+=4)Y[p]=t.getUint32(n),z[p]=t.getUint32(n+=4);for(let p=16;p<80;p++){const N=Y[p-15]|0,O=z[p-15]|0,a=tt(N,O,1)^tt(N,O,8)^Zt(N,O,7),h=et(N,O,1)^et(N,O,8)^jt(N,O,7),f=Y[p-2]|0,l=z[p-2]|0,d=tt(f,l,19)^st(f,l,61)^Zt(f,l,6),b=et(f,l,19)^it(f,l,61)^jt(f,l,6),g=We(h,b,z[p-7],z[p-16]),m=Xe(g,a,d,Y[p-7],Y[p-16]);Y[p]=m|0,z[p]=g|0}let{Ah:o,Al:r,Bh:s,Bl:c,Ch:u,Cl:i,Dh:x,Dl:y,Eh:w,El:S,Fh:I,Fl:v,Gh:T,Gl:_,Hh:E,Hl:R}=this;for(let p=0;p<80;p++){const N=tt(w,S,14)^tt(w,S,18)^st(w,S,41),O=et(w,S,14)^et(w,S,18)^it(w,S,41),a=w&I^~w&T,h=S&v^~S&_,f=Pe(R,O,h,Je[p],z[p]),l=Fe(f,E,N,a,Qe[p],Y[p]),d=f|0,b=tt(o,r,28)^st(o,r,34)^st(o,r,39),g=et(o,r,28)^it(o,r,34)^it(o,r,39),m=o&s^o&u^s&u,B=r&c^r&i^c&i;E=T|0,R=_|0,T=I|0,_=v|0,I=w|0,v=S|0,{h:w,l:S}=k(x|0,y|0,l|0,d|0),x=u|0,y=i|0,u=s|0,i=c|0,s=o|0,c=r|0;const A=Ye(d,g,B);o=ze(A,l,b,m),r=A|0}({h:o,l:r}=k(this.Ah|0,this.Al|0,o|0,r|0)),{h:s,l:c}=k(this.Bh|0,this.Bl|0,s|0,c|0),{h:u,l:i}=k(this.Ch|0,this.Cl|0,u|0,i|0),{h:x,l:y}=k(this.Dh|0,this.Dl|0,x|0,y|0),{h:w,l:S}=k(this.Eh|0,this.El|0,w|0,S|0),{h:I,l:v}=k(this.Fh|0,this.Fl|0,I|0,v|0),{h:T,l:_}=k(this.Gh|0,this.Gl|0,T|0,_|0),{h:E,l:R}=k(this.Hh|0,this.Hl|0,E|0,R|0),this.set(o,r,s,c,u,i,x,y,w,S,I,v,T,_,E,R)}roundClean(){Bt(Y,z)}destroy(){Bt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class en extends tn{Ah=M[0]|0;Al=M[1]|0;Bh=M[2]|0;Bl=M[3]|0;Ch=M[4]|0;Cl=M[5]|0;Dh=M[6]|0;Dl=M[7]|0;Eh=M[8]|0;El=M[9]|0;Fh=M[10]|0;Fl=M[11]|0;Gh=M[12]|0;Gl=M[13]|0;Hh=M[14]|0;Hl=M[15]|0;constructor(){super(64)}}const nn=$e(()=>new en,je(3));const fe=BigInt(0),Vt=BigInt(1);function St(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}" `;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function rn(e){if(typeof e=="bigint"){if(!ft(e))throw new Error("positive bigint expected, got "+e)}else _t(e);return e}function ae(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?fe:BigInt("0x"+e)}function on(e){return ae(Nt(e))}function at(e){return ae(Nt(vt(D(e)).reverse()))}function ue(e,t){_t(t),e=rn(e);const n=ie(e.toString(16).padStart(t*2,"0"));if(n.length!==t)throw new Error("number too large");return n}function sn(e,t){return ue(e,t).reverse()}function vt(e){return Uint8Array.from(e)}const ft=e=>typeof e=="bigint"&&fe<=e;function cn(e,t,n){return ft(e)&&ft(t)&&ft(n)&&t<=e&&e<n}function kt(e,t,n,o){if(!cn(t,n,o))throw new Error("expected valid "+e+": "+n+" <= n < "+o+", got "+t)}const fn=e=>(Vt<<BigInt(e))-Vt;function Tt(e,t={},n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function o(s,c,u){const i=e[s];if(u&&i===void 0)return;const x=typeof i;if(x!==c||i===null)throw new Error(`param "${s}" is invalid: expected ${c}, got ${x}`)}const r=(s,c)=>Object.entries(s).forEach(([u,i])=>o(u,i,c));r(t,!1),r(n,!0)}function Kt(e){const t=new WeakMap;return(n,...o)=>{const r=t.get(n);if(r!==void 0)return r;const s=e(n,...o);return t.set(n,s),s}}const $=BigInt(0),G=BigInt(1),Q=BigInt(2),he=BigInt(3),le=BigInt(4),de=BigInt(5),an=BigInt(7),be=BigInt(8),un=BigInt(9),ge=BigInt(16);function U(e,t){const n=e%t;return n>=$?n:t+n}function Z(e,t,n){let o=e;for(;t-- >$;)o*=o,o%=n;return o}function Yt(e,t){if(e===$)throw new Error("invert: expected non-zero number");if(t<=$)throw new Error("invert: expected positive modulus, got "+t);let n=U(e,t),o=t,r=$,s=G;for(;n!==$;){const u=o/n,i=o%n,x=r-s*u;o=n,n=i,r=s,s=x}if(o!==G)throw new Error("invert: does not exist");return U(r,t)}function Ot(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function we(e,t){const n=(e.ORDER+G)/le,o=e.pow(t,n);return Ot(e,o,t),o}function hn(e,t){const n=(e.ORDER-de)/be,o=e.mul(t,Q),r=e.pow(o,n),s=e.mul(t,r),c=e.mul(e.mul(s,Q),r),u=e.mul(s,e.sub(c,e.ONE));return Ot(e,u,t),u}function ln(e){const t=Ct(e),n=xe(e),o=n(t,t.neg(t.ONE)),r=n(t,o),s=n(t,t.neg(o)),c=(e+an)/ge;return(u,i)=>{let x=u.pow(i,c),y=u.mul(x,o);const w=u.mul(x,r),S=u.mul(x,s),I=u.eql(u.sqr(y),i),v=u.eql(u.sqr(w),i);x=u.cmov(x,y,I),y=u.cmov(S,w,v);const T=u.eql(u.sqr(y),i),_=u.cmov(x,y,T);return Ot(u,_,i),_}}function xe(e){if(e<he)throw new Error("sqrt is not defined for small field");let t=e-G,n=0;for(;t%Q===$;)t/=Q,n++;let o=Q;const r=Ct(e);for(;zt(r,o)===1;)if(o++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return we;let s=r.pow(o,t);const c=(t+G)/Q;return function(i,x){if(i.is0(x))return x;if(zt(i,x)!==1)throw new Error("Cannot find square root");let y=n,w=i.mul(i.ONE,s),S=i.pow(x,t),I=i.pow(x,c);for(;!i.eql(S,i.ONE);){if(i.is0(S))return i.ZERO;let v=1,T=i.sqr(S);for(;!i.eql(T,i.ONE);)if(v++,T=i.sqr(T),v===y)throw new Error("Cannot find square root");const _=G<<BigInt(y-v-1),E=i.pow(w,_);y=v,w=i.sqr(E),S=i.mul(S,w),I=i.mul(I,E)}return I}}function dn(e){return e%le===he?we:e%be===de?hn:e%ge===un?ln(e):xe(e)}const bn=(e,t)=>(U(e,t)&G)===G,gn=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function wn(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=gn.reduce((o,r)=>(o[r]="function",o),t);return Tt(e,n),e}function xn(e,t,n){if(n<$)throw new Error("invalid exponent, negatives unsupported");if(n===$)return e.ONE;if(n===G)return t;let o=e.ONE,r=t;for(;n>$;)n&G&&(o=e.mul(o,r)),r=e.sqr(r),n>>=G;return o}function pe(e,t,n=!1){const o=new Array(t.length).fill(n?e.ZERO:void 0),r=t.reduce((c,u,i)=>e.is0(u)?c:(o[i]=c,e.mul(c,u)),e.ONE),s=e.inv(r);return t.reduceRight((c,u,i)=>e.is0(u)?c:(o[i]=e.mul(c,o[i]),e.mul(c,u)),s),o}function zt(e,t){const n=(e.ORDER-G)/Q,o=e.pow(t,n),r=e.eql(o,e.ONE),s=e.eql(o,e.ZERO),c=e.eql(o,e.neg(e.ONE));if(!r&&!s&&!c)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function pn(e,t){t!==void 0&&_t(t);const n=t!==void 0?t:e.toString(2).length,o=Math.ceil(n/8);return{nBitLength:n,nByteLength:o}}class mn{ORDER;BITS;BYTES;isLE;ZERO=$;ONE=G;_lengths;_sqrt;_mod;constructor(t,n={}){if(t<=$)throw new Error("invalid field: expected ORDER > 0, got "+t);let o;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(o=n.BITS),typeof n.sqrt=="function"&&(this.sqrt=n.sqrt),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=n.allowedLengths?.slice()),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));const{nBitLength:r,nByteLength:s}=pn(t,o);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return U(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return $<=t&&t<this.ORDER}is0(t){return t===$}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&G)===G}neg(t){return U(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return U(t*t,this.ORDER)}add(t,n){return U(t+n,this.ORDER)}sub(t,n){return U(t-n,this.ORDER)}mul(t,n){return U(t*n,this.ORDER)}pow(t,n){return xn(this,t,n)}div(t,n){return U(t*Yt(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return Yt(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=dn(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?sn(t,this.BYTES):ue(t,this.BYTES)}fromBytes(t,n=!1){D(t);const{_lengths:o,BYTES:r,isLE:s,ORDER:c,_mod:u}=this;if(o){if(!o.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+t.length);const x=new Uint8Array(r);x.set(t,s?0:x.length-t.length),t=x}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let i=s?at(t):on(t);if(u&&(i=U(i,c)),!n&&!this.isValid(i))throw new Error("invalid field element: outside of range 0..ORDER");return i}invertBatch(t){return pe(this,t)}cmov(t,n,o){return o?n:t}}function Ct(e,t={}){return new mn(e,t)}const ut=BigInt(0),Rt=BigInt(1);function Wt(e,t){const n=t.negate();return e?n:t}function gt(e,t){const n=pe(e.Fp,t.map(o=>o.Z));return t.map((o,r)=>e.fromAffine(o.toAffine(n[r])))}function me(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function wt(e,t){me(e,t);const n=Math.ceil(t/e)+1,o=2**(e-1),r=2**e,s=fn(e),c=BigInt(e);return{windows:n,windowSize:o,mask:s,maxNumber:r,shiftBy:c}}function Xt(e,t,n){const{windowSize:o,mask:r,maxNumber:s,shiftBy:c}=n;let u=Number(e&r),i=e>>c;u>o&&(u-=s,i+=Rt);const x=t*o,y=x+Math.abs(u)-1,w=u===0,S=u<0,I=t%2!==0;return{nextN:i,offset:y,isZero:w,isNeg:S,isNegF:I,offsetF:x}}const xt=new WeakMap,ye=new WeakMap;function pt(e){return ye.get(e)||1}function Pt(e){if(e!==ut)throw new Error("invalid wNAF")}class yn{BASE;ZERO;Fn;bits;constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,o=this.ZERO){let r=t;for(;n>ut;)n&Rt&&(o=o.add(r)),r=r.double(),n>>=Rt;return o}precomputeWindow(t,n){const{windows:o,windowSize:r}=wt(n,this.bits),s=[];let c=t,u=c;for(let i=0;i<o;i++){u=c,s.push(u);for(let x=1;x<r;x++)u=u.add(c),s.push(u);c=u.double()}return s}wNAF(t,n,o){if(!this.Fn.isValid(o))throw new Error("invalid scalar");let r=this.ZERO,s=this.BASE;const c=wt(t,this.bits);for(let u=0;u<c.windows;u++){const{nextN:i,offset:x,isZero:y,isNeg:w,isNegF:S,offsetF:I}=Xt(o,u,c);o=i,y?s=s.add(Wt(S,n[I])):r=r.add(Wt(w,n[x]))}return Pt(o),{p:r,f:s}}wNAFUnsafe(t,n,o,r=this.ZERO){const s=wt(t,this.bits);for(let c=0;c<s.windows&&o!==ut;c++){const{nextN:u,offset:i,isZero:x,isNeg:y}=Xt(o,c,s);if(o=u,!x){const w=n[i];r=r.add(y?w.negate():w)}}return Pt(o),r}getPrecomputes(t,n,o){let r=xt.get(n);return r||(r=this.precomputeWindow(n,t),t!==1&&(typeof o=="function"&&(r=o(r)),xt.set(n,r))),r}cached(t,n,o){const r=pt(t);return this.wNAF(r,this.getPrecomputes(r,t,o),n)}unsafe(t,n,o,r){const s=pt(t);return s===1?this._unsafeLadder(t,n,r):this.wNAFUnsafe(s,this.getPrecomputes(s,t,o),n,r)}createCache(t,n){me(n,this.bits),ye.set(t,n),xt.delete(t)}hasCache(t){return pt(t)!==1}}function Ft(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return wn(t),t}else return Ct(e,{isLE:n})}function En(e,t,n={},o){if(o===void 0&&(o=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const i of["p","n","h"]){const x=t[i];if(!(typeof x=="bigint"&&x>ut))throw new Error(`CURVE.${i} must be positive bigint`)}const r=Ft(t.p,n.Fp,o),s=Ft(t.n,n.Fn,o),u=["Gx","Gy","a","d"];for(const i of u)if(!r.isValid(t[i]))throw new Error(`CURVE.${i} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:s}}function Bn(e,t){return function(o){const r=e(o);return{secretKey:r,publicKey:t(r)}}}const W=BigInt(0),H=BigInt(1),mt=BigInt(2),Sn=BigInt(8);function vn(e,t,n,o){const r=e.sqr(n),s=e.sqr(o),c=e.add(e.mul(t.a,r),s),u=e.add(e.ONE,e.mul(t.d,e.mul(r,s)));return e.eql(c,u)}function Rn(e,t={}){const n=En("edwards",e,t,t.FpFnLE),{Fp:o,Fn:r}=n;let s=n.CURVE;const{h:c}=s;Tt(t,{},{uvRatio:"function"});const u=mt<<BigInt(r.BYTES*8)-H,i=_=>o.create(_),x=t.uvRatio||((_,E)=>{try{return{isValid:!0,value:o.sqrt(o.div(_,E))}}catch{return{isValid:!1,value:W}}});if(!vn(o,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function y(_,E,R=!1){const p=R?H:W;return kt("coordinate "+_,E,p,u),E}function w(_){if(!(_ instanceof v))throw new Error("EdwardsPoint expected")}const S=Kt((_,E)=>{const{X:R,Y:p,Z:N}=_,O=_.is0();E==null&&(E=O?Sn:o.inv(N));const a=i(R*E),h=i(p*E),f=o.mul(N,E);if(O)return{x:W,y:H};if(f!==H)throw new Error("invZ was invalid");return{x:a,y:h}}),I=Kt(_=>{const{a:E,d:R}=s;if(_.is0())throw new Error("bad point: ZERO");const{X:p,Y:N,Z:O,T:a}=_,h=i(p*p),f=i(N*N),l=i(O*O),d=i(l*l),b=i(h*E),g=i(l*i(b+f)),m=i(d+i(R*i(h*f)));if(g!==m)throw new Error("bad point: equation left != right (1)");const B=i(p*N),A=i(O*a);if(B!==A)throw new Error("bad point: equation left != right (2)");return!0});class v{static BASE=new v(s.Gx,s.Gy,H,i(s.Gx*s.Gy));static ZERO=new v(W,H,H,W);static Fp=o;static Fn=r;X;Y;Z;T;constructor(E,R,p,N){this.X=y("x",E),this.Y=y("y",R),this.Z=y("z",p,!0),this.T=y("t",N),Object.freeze(this)}static CURVE(){return s}static fromAffine(E){if(E instanceof v)throw new Error("extended point not allowed");const{x:R,y:p}=E||{};return y("x",R),y("y",p),new v(R,p,H,i(R*p))}static fromBytes(E,R=!1){const p=o.BYTES,{a:N,d:O}=s;E=vt(D(E,p,"point")),St(R,"zip215");const a=vt(E),h=E[p-1];a[p-1]=h&-129;const f=at(a),l=R?u:o.ORDER;kt("point.y",f,W,l);const d=i(f*f),b=i(d-H),g=i(O*d-N);let{isValid:m,value:B}=x(b,g);if(!m)throw new Error("bad point: invalid y coordinate");const A=(B&H)===H,C=(h&128)!==0;if(!R&&B===W&&C)throw new Error("bad point: x=0 and x_0=1");return C!==A&&(B=i(-B)),v.fromAffine({x:B,y:f})}static fromHex(E,R=!1){return v.fromBytes(ie(E),R)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(E=8,R=!0){return T.createCache(this,E),R||this.multiply(mt),this}assertValidity(){I(this)}equals(E){w(E);const{X:R,Y:p,Z:N}=this,{X:O,Y:a,Z:h}=E,f=i(R*h),l=i(O*N),d=i(p*h),b=i(a*N);return f===l&&d===b}is0(){return this.equals(v.ZERO)}negate(){return new v(i(-this.X),this.Y,this.Z,i(-this.T))}double(){const{a:E}=s,{X:R,Y:p,Z:N}=this,O=i(R*R),a=i(p*p),h=i(mt*i(N*N)),f=i(E*O),l=R+p,d=i(i(l*l)-O-a),b=f+a,g=b-h,m=f-a,B=i(d*g),A=i(b*m),C=i(d*m),L=i(g*b);return new v(B,A,L,C)}add(E){w(E);const{a:R,d:p}=s,{X:N,Y:O,Z:a,T:h}=this,{X:f,Y:l,Z:d,T:b}=E,g=i(N*f),m=i(O*l),B=i(h*p*b),A=i(a*d),C=i((N+O)*(f+l)-g-m),L=A-B,q=A+B,J=i(m-R*g),rt=i(C*L),lt=i(q*J),Ut=i(C*J),Ht=i(L*q);return new v(rt,lt,Ht,Ut)}subtract(E){return this.add(E.negate())}multiply(E){if(!r.isValidNot0(E))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:R,f:p}=T.cached(this,E,N=>gt(v,N));return gt(v,[R,p])[0]}multiplyUnsafe(E,R=v.ZERO){if(!r.isValid(E))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return E===W?v.ZERO:this.is0()||E===H?this:T.unsafe(this,E,p=>gt(v,p),R)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return T.unsafe(this,s.n).is0()}toAffine(E){return S(this,E)}clearCofactor(){return c===H?this:this.multiplyUnsafe(c)}toBytes(){const{x:E,y:R}=this.toAffine(),p=o.toBytes(R);return p[p.length-1]|=E&H?128:0,p}toHex(){return Nt(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const T=new yn(v,r.BITS);return v.BASE.precompute(8),v}function An(e,t,n={}){if(typeof t!="function")throw new Error('"hash" function param is required');Tt(n,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:o}=n,{BASE:r,Fp:s,Fn:c}=e,u=n.randomBytes||Ze,i=n.adjustScalarBytes||(f=>f),x=n.domain||((f,l,d)=>{if(St(d,"phflag"),l.length||d)throw new Error("Contexts/pre-hash are not supported");return f});function y(f){return c.create(at(f))}function w(f){const l=p.secretKey;D(f,p.secretKey,"secretKey");const d=D(t(f),2*l,"hashedSecretKey"),b=i(d.slice(0,l)),g=d.slice(l,2*l),m=y(b);return{head:b,prefix:g,scalar:m}}function S(f){const{head:l,prefix:d,scalar:b}=w(f),g=r.multiply(b),m=g.toBytes();return{head:l,prefix:d,scalar:b,point:g,pointBytes:m}}function I(f){return S(f).pointBytes}function v(f=Uint8Array.of(),...l){const d=Gt(...l);return y(t(x(d,D(f,void 0,"context"),!!o)))}function T(f,l,d={}){f=D(f,void 0,"message"),o&&(f=o(f));const{prefix:b,scalar:g,pointBytes:m}=S(l),B=v(d.context,b,f),A=r.multiply(B).toBytes(),C=v(d.context,A,m,f),L=c.create(B+C*g);if(!c.isValid(L))throw new Error("sign failed: invalid s");const q=Gt(A,c.toBytes(L));return D(q,p.signature,"result")}const _={zip215:!0};function E(f,l,d,b=_){const{context:g,zip215:m}=b,B=p.signature;f=D(f,B,"signature"),l=D(l,void 0,"message"),d=D(d,p.publicKey,"publicKey"),m!==void 0&&St(m,"zip215"),o&&(l=o(l));const A=B/2,C=f.subarray(0,A),L=at(f.subarray(A,B));let q,J,rt;try{q=e.fromBytes(d,m),J=e.fromBytes(C,m),rt=r.multiplyUnsafe(L)}catch{return!1}if(!m&&q.isSmallOrder())return!1;const lt=v(g,J.toBytes(),q.toBytes(),l);return J.add(q.multiplyUnsafe(lt)).subtract(rt).clearCofactor().is0()}const R=s.BYTES,p={secretKey:R,publicKey:R,signature:2*R,seed:R};function N(f=u(p.seed)){return D(f,p.seed,"seed")}function O(f){return oe(f)&&f.length===c.BYTES}function a(f,l){try{return!!e.fromBytes(f,l)}catch{return!1}}const h={getExtendedPublicKey:S,randomSecretKey:N,isValidSecretKey:O,isValidPublicKey:a,toMontgomery(f){const{y:l}=e.fromBytes(f),d=p.publicKey,b=d===32;if(!b&&d!==57)throw new Error("only defined for 25519 and 448");const g=b?s.div(H+l,H-l):s.div(l-H,l+H);return s.toBytes(g)},toMontgomerySecret(f){const l=p.secretKey;D(f,l);const d=t(f.subarray(0,l));return i(d).subarray(0,l)}};return Object.freeze({keygen:Bn(N,I),getPublicKey:I,sign:T,verify:E,utils:h,Point:e,lengths:p})}const In=BigInt(1),Qt=BigInt(2),_n=BigInt(5),Nn=BigInt(8),Lt=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Tn={p:Lt,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Nn,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function On(e){const t=BigInt(10),n=BigInt(20),o=BigInt(40),r=BigInt(80),s=Lt,u=e*e%s*e%s,i=Z(u,Qt,s)*u%s,x=Z(i,In,s)*e%s,y=Z(x,_n,s)*x%s,w=Z(y,t,s)*y%s,S=Z(w,n,s)*w%s,I=Z(S,o,s)*S%s,v=Z(I,r,s)*I%s,T=Z(v,r,s)*I%s,_=Z(T,t,s)*y%s;return{pow_p_5_8:Z(_,Qt,s)*e%s,b2:u}}function Cn(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const Jt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Ln(e,t){const n=Lt,o=U(t*t*t,n),r=U(o*o*t,n),s=On(e*r).pow_p_5_8;let c=U(e*o*s,n);const u=U(t*c*c,n),i=c,x=U(c*Jt,n),y=u===e,w=u===U(-e,n),S=u===U(-e*Jt,n);return y&&(c=i),(w||S)&&(c=x),bn(c,n)&&(c=U(-c,n)),{isValid:y||w,value:c}}const Un=Rn(Tn,{uvRatio:Ln});function Hn(e){return An(Un,nn,Object.assign({adjustScalarBytes:Cn},e))}const Dn=Hn({});function qn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ht(e,...t){if(!qn(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function te(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Mn(e,t){ht(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function At(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function yt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function j(e,t){return e<<32-t|e>>>t}function Gn(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ee(e){return typeof e=="string"&&(e=Gn(e)),ht(e),e}class $n{}function Zn(e){const t=o=>e().update(Ee(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function jn(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);const r=BigInt(32),s=BigInt(4294967295),c=Number(n>>r&s),u=Number(n&s),i=o?4:0,x=o?0:4;e.setUint32(t+i,c,o),e.setUint32(t+x,u,o)}function Vn(e,t,n){return e&t^~e&n}function kn(e,t,n){return e&t^e&n^t&n}class Kn extends $n{constructor(t,n,o,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=r,this.buffer=new Uint8Array(t),this.view=yt(this.buffer)}update(t){te(this),t=Ee(t),ht(t);const{view:n,buffer:o,blockLen:r}=this,s=t.length;for(let c=0;c<s;){const u=Math.min(r-this.pos,s-c);if(u===r){const i=yt(t);for(;r<=s-c;c+=r)this.process(i,c);continue}o.set(t.subarray(c,c+u),this.pos),this.pos+=u,c+=u,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){te(this),Mn(t,this),this.finished=!0;const{buffer:n,view:o,blockLen:r,isLE:s}=this;let{pos:c}=this;n[c++]=128,At(this.buffer.subarray(c)),this.padOffset>r-c&&(this.process(o,0),c=0);for(let w=c;w<r;w++)n[w]=0;jn(o,r-8,BigInt(this.length*8),s),this.process(o,0);const u=yt(t),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const x=i/4,y=this.get();if(x>y.length)throw new Error("_sha2: outputLen bigger than state");for(let w=0;w<x;w++)u.setUint32(4*w,y[w],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:o,length:r,finished:s,destroyed:c,pos:u}=this;return t.destroyed=c,t.finished=s,t.length=r,t.pos=u,r%n&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const X=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yn=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),P=new Uint32Array(64);class zn extends Kn{constructor(t=32){super(64,t,8,!1),this.A=X[0]|0,this.B=X[1]|0,this.C=X[2]|0,this.D=X[3]|0,this.E=X[4]|0,this.F=X[5]|0,this.G=X[6]|0,this.H=X[7]|0}get(){const{A:t,B:n,C:o,D:r,E:s,F:c,G:u,H:i}=this;return[t,n,o,r,s,c,u,i]}set(t,n,o,r,s,c,u,i){this.A=t|0,this.B=n|0,this.C=o|0,this.D=r|0,this.E=s|0,this.F=c|0,this.G=u|0,this.H=i|0}process(t,n){for(let w=0;w<16;w++,n+=4)P[w]=t.getUint32(n,!1);for(let w=16;w<64;w++){const S=P[w-15],I=P[w-2],v=j(S,7)^j(S,18)^S>>>3,T=j(I,17)^j(I,19)^I>>>10;P[w]=T+P[w-7]+v+P[w-16]|0}let{A:o,B:r,C:s,D:c,E:u,F:i,G:x,H:y}=this;for(let w=0;w<64;w++){const S=j(u,6)^j(u,11)^j(u,25),I=y+S+Vn(u,i,x)+Yn[w]+P[w]|0,T=(j(o,2)^j(o,13)^j(o,22))+kn(o,r,s)|0;y=x,x=i,i=u,u=c+I|0,c=s,s=r,r=o,o=I+T|0}o=o+this.A|0,r=r+this.B|0,s=s+this.C|0,c=c+this.D|0,u=u+this.E|0,i=i+this.F|0,x=x+this.G|0,y=y+this.H|0,this.set(o,r,s,c,u,i,x,y)}roundClean(){At(P)}destroy(){this.set(0,0,0,0,0,0,0,0),At(this.buffer)}}const Be=Zn(()=>new zn),Wn=Be,Xn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function Pn(e){if(e.length!==16)throw new Error(`Invalid seed length: expected 16, got ${e.length}`);const t=Wn(e),n=Dn.getPublicKey(t),o=new Uint8Array(64);return o.set(t,0),o.set(n,32),K.wipeBytes(t),{publicKey:n,secretKey:o}}function Fn(e){const t=Pn(e),n=t.publicKey;return K.wipeBytes(t.secretKey),n}function Qn(e){if(e.length!==32)throw new Error(`Invalid public key length: expected 32, got ${e.length}`);return Jn(e)}function Jn(e){let t=0;for(let r=0;r<e.length&&e[r]===0;r++)t++;let n=0n;for(let r=0;r<e.length;r++)n=n*256n+BigInt(e[r]);let o="";for(;n>0n;){const r=Number(n%58n);o=Xn[r]+o,n=n/58n}return"1".repeat(t)+o}const tr=2,er=3;function nr(e){if(e.length!==16)throw new Error(`Invalid seed length: expected 16, got ${e.length}`);const t=It(e),n=re.share(t,er,tr);if(n.length!==3)throw new Error(`Unexpected share count: ${n.length}`);const o=Et(n[0]),r=Et(n[1]),s=Et(n[2]);return{shareA:K.toShamirShare(o),shareB:K.toShamirShare(r),shareC:K.toShamirShare(s)}}function rr(e,t,n){const o=ee(e),r=ee(t);try{const s=re.combine([o,r]),c=Se(s);if(c.length!==16)throw new Error(`Reconstructed seed has wrong length: ${c.length}`);return K.toSeed(c)}catch(s){throw s instanceof Error&&s.message.startsWith("Reconstructed seed")||s instanceof Error&&s.message.startsWith("Invalid expectedPublicKey")||s instanceof Error&&s.message.startsWith("Reconstructed seed does not match")?s:new Error("Failed to reconstruct seed from shares")}}function It(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Se(e){if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("Invalid hex string: contains non-hex characters");if(e.length%2!==0)throw new Error(`Invalid hex string: length ${e.length} is odd (must be even)`);const t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++)t[n]=parseInt(e.substr(n*2,2),16);return t}function Et(e){const t=e.length%2!==0,n=t?"0"+e:e,o=Se(n),r=new Uint8Array(1+o.length);return r[0]=t?1:0,r.set(o,1),r}function ee(e){const t=e[0];if(t===0||t===1){const o=t===1,r=e.subarray(1),s=It(r),c=o?s.substring(1):s;if(/^[0-9a-f]/.test(c))return c}const n=It(e);return n.startsWith("0")&&!n.startsWith("00")?n.substring(1):n}exports.abytes=ht;exports.argon2DeriveInWorker=Ae;exports.combineShares=rr;exports.getDefaultExportFromCjs=ne;exports.getPublicKeyFromSeed=Fn;exports.publicKeyToBase58=Qn;exports.sha256=Be;exports.splitSecret=nr;
|