@cedros/login-react 0.0.46 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +32 -2
  2. package/dist/AdminWithdrawalHistory-CgYehfMH.js +948 -0
  3. package/dist/AdminWithdrawalHistory-CgYehfMH.js.map +1 -0
  4. package/dist/AdminWithdrawalHistory-zDUhPDNi.cjs +1 -0
  5. package/dist/AdminWithdrawalHistory-zDUhPDNi.cjs.map +1 -0
  6. package/dist/EmailRegisterForm-ByYQ43yL.cjs +1 -0
  7. package/dist/EmailRegisterForm-ByYQ43yL.cjs.map +1 -0
  8. package/dist/EmailRegisterForm-DMUcNQT-.js +781 -0
  9. package/dist/EmailRegisterForm-DMUcNQT-.js.map +1 -0
  10. package/dist/GoogleLoginButton-DEwtBp56.cjs +1 -0
  11. package/dist/GoogleLoginButton-DEwtBp56.cjs.map +1 -0
  12. package/dist/{GoogleLoginButton-C1WNu7W3.js → GoogleLoginButton-DwyxvhnL.js} +82 -80
  13. package/dist/GoogleLoginButton-DwyxvhnL.js.map +1 -0
  14. package/dist/{PermissionsSection-mm9hfp-u.js → PermissionsSection-0oNHPZzL.js} +383 -415
  15. package/dist/PermissionsSection-0oNHPZzL.js.map +1 -0
  16. package/dist/PermissionsSection-CZsJuxo4.cjs +1 -0
  17. package/dist/PermissionsSection-CZsJuxo4.cjs.map +1 -0
  18. package/dist/SolanaLoginButton-2504p6cr.cjs +1 -0
  19. package/dist/SolanaLoginButton-2504p6cr.cjs.map +1 -0
  20. package/dist/SolanaLoginButton-C7Kc_m6n.js +234 -0
  21. package/dist/SolanaLoginButton-C7Kc_m6n.js.map +1 -0
  22. package/dist/{TeamSection-Km7EwLWD.cjs → TeamSection-DN8PEHH3.cjs} +1 -1
  23. package/dist/{TeamSection-Km7EwLWD.cjs.map → TeamSection-DN8PEHH3.cjs.map} +1 -1
  24. package/dist/{TeamSection-C_eODdLU.js → TeamSection-gUyP4YDM.js} +1 -1
  25. package/dist/{TeamSection-C_eODdLU.js.map → TeamSection-gUyP4YDM.js.map} +1 -1
  26. package/dist/{UsersSection-C1Tt0ePx.cjs → UsersSection-8wLuD0fr.cjs} +1 -1
  27. package/dist/{UsersSection-C1Tt0ePx.cjs.map → UsersSection-8wLuD0fr.cjs.map} +1 -1
  28. package/dist/{UsersSection-Ct_E-MBF.js → UsersSection-CnsFrG-6.js} +1 -1
  29. package/dist/{UsersSection-Ct_E-MBF.js.map → UsersSection-CnsFrG-6.js.map} +1 -1
  30. package/dist/{WithdrawalsSection-BN-FjTEV.js → WithdrawalsSection-BCG_-DAP.js} +1 -1
  31. package/dist/{WithdrawalsSection-BN-FjTEV.js.map → WithdrawalsSection-BCG_-DAP.js.map} +1 -1
  32. package/dist/{WithdrawalsSection-BhuCwFat.cjs → WithdrawalsSection-DKpL2mt8.cjs} +1 -1
  33. package/dist/{WithdrawalsSection-BhuCwFat.cjs.map → WithdrawalsSection-DKpL2mt8.cjs.map} +1 -1
  34. package/dist/admin-only.cjs +1 -1
  35. package/dist/admin-only.js +1 -1
  36. package/dist/email-only.cjs +1 -1
  37. package/dist/email-only.d.ts +10 -2
  38. package/dist/email-only.js +2 -2
  39. package/dist/google-only.cjs +1 -1
  40. package/dist/google-only.d.ts +7 -2
  41. package/dist/google-only.js +2 -2
  42. package/dist/index.cjs +12 -12
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.d.ts +182 -11
  45. package/dist/index.js +5000 -4409
  46. package/dist/index.js.map +1 -1
  47. package/dist/login-react.css +1 -1
  48. package/dist/{plugin-Ci67QMGG.cjs → plugin-C7dru1t-.cjs} +1 -1
  49. package/dist/{plugin-Ci67QMGG.cjs.map → plugin-C7dru1t-.cjs.map} +1 -1
  50. package/dist/{plugin-Cm8Q6O4-.js → plugin-DivbaxSZ.js} +1 -1
  51. package/dist/{plugin-Cm8Q6O4-.js.map → plugin-DivbaxSZ.js.map} +1 -1
  52. package/dist/solana-only.cjs +1 -1
  53. package/dist/solana-only.d.ts +6 -1
  54. package/dist/solana-only.js +2 -2
  55. package/dist/useAuth-2vgrAH-M.cjs +1 -0
  56. package/dist/useAuth-2vgrAH-M.cjs.map +1 -0
  57. package/dist/{useAuth-l-itM5am.js → useAuth-CNflw856.js} +465 -469
  58. package/dist/useAuth-CNflw856.js.map +1 -0
  59. package/dist/useServerFeatures-9_aNPaa6.cjs +1 -0
  60. package/dist/useServerFeatures-9_aNPaa6.cjs.map +1 -0
  61. package/dist/useServerFeatures-DSkYdan-.js +82 -0
  62. package/dist/useServerFeatures-DSkYdan-.js.map +1 -0
  63. package/dist/{useUsersStatsSummary-BGeh3RnI.js → useUsersStatsSummary-B4_RBEYy.js} +504 -442
  64. package/dist/useUsersStatsSummary-B4_RBEYy.js.map +1 -0
  65. package/dist/useUsersStatsSummary-CHRMrlk4.cjs +1 -0
  66. package/dist/useUsersStatsSummary-CHRMrlk4.cjs.map +1 -0
  67. package/package.json +1 -1
  68. package/dist/AdminWithdrawalHistory-B2EY2ZmH.cjs +0 -1
  69. package/dist/AdminWithdrawalHistory-B2EY2ZmH.cjs.map +0 -1
  70. package/dist/AdminWithdrawalHistory-C76bkbjX.js +0 -916
  71. package/dist/AdminWithdrawalHistory-C76bkbjX.js.map +0 -1
  72. package/dist/EmailRegisterForm-p2X5QP58.js +0 -750
  73. package/dist/EmailRegisterForm-p2X5QP58.js.map +0 -1
  74. package/dist/EmailRegisterForm-xFb6MaVA.cjs +0 -1
  75. package/dist/EmailRegisterForm-xFb6MaVA.cjs.map +0 -1
  76. package/dist/GoogleLoginButton-2zNTIKMm.cjs +0 -1
  77. package/dist/GoogleLoginButton-2zNTIKMm.cjs.map +0 -1
  78. package/dist/GoogleLoginButton-C1WNu7W3.js.map +0 -1
  79. package/dist/PermissionsSection-4zcE9Zs9.cjs +0 -1
  80. package/dist/PermissionsSection-4zcE9Zs9.cjs.map +0 -1
  81. package/dist/PermissionsSection-mm9hfp-u.js.map +0 -1
  82. package/dist/SolanaLoginButton-CqdzSSeJ.cjs +0 -1
  83. package/dist/SolanaLoginButton-CqdzSSeJ.cjs.map +0 -1
  84. package/dist/SolanaLoginButton-CyeX35eU.js +0 -232
  85. package/dist/SolanaLoginButton-CyeX35eU.js.map +0 -1
  86. package/dist/sanitization-Bo_tn-L2.cjs +0 -1
  87. package/dist/sanitization-Bo_tn-L2.cjs.map +0 -1
  88. package/dist/sanitization-CQ-H1MSg.js +0 -39
  89. package/dist/sanitization-CQ-H1MSg.js.map +0 -1
  90. package/dist/useAuth-B1yS_YiD.cjs +0 -1
  91. package/dist/useAuth-B1yS_YiD.cjs.map +0 -1
  92. package/dist/useAuth-l-itM5am.js.map +0 -1
  93. package/dist/useUsersStatsSummary-BGeh3RnI.js.map +0 -1
  94. package/dist/useUsersStatsSummary-DnsYtFGX.cjs +0 -1
  95. package/dist/useUsersStatsSummary-DnsYtFGX.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-Cm8Q6O4-.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 getReferralCode: () => null,\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\n/**\n * All section IDs registered by the cedros-login plugin.\n *\n * Use these to reference specific sections when configuring\n * `dashboardPermissions.canAccess()` or navigating programmatically.\n *\n * Qualified IDs (for multi-plugin use) are prefixed: `cedros-login:{id}`.\n */\nexport const CEDROS_LOGIN_SECTION_IDS = {\n users: 'users',\n team: 'team',\n deposits: 'deposits',\n withdrawals: 'withdrawals',\n settingsAuth: 'settings-auth',\n settingsEmail: 'settings-email',\n settingsWebhooks: 'settings-webhooks',\n settingsWallet: 'settings-wallet',\n settingsCredits: 'settings-credits',\n settingsServer: 'settings-server',\n} as const;\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","CEDROS_LOGIN_SECTION_IDS"],"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,EAAAC,EAAU,MAAM;AACd,aAASC,EAAmBC,GAAmB;AAC7C,MAAIJ,EAAY,WAAW,CAACA,EAAY,Q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,gBAAgB;AAClB;"}
1
+ {"version":3,"file":"plugin-DivbaxSZ.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 getReferralCode: () => null,\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\n/**\n * All section IDs registered by the cedros-login plugin.\n *\n * Use these to reference specific sections when configuring\n * `dashboardPermissions.canAccess()` or navigating programmatically.\n *\n * Qualified IDs (for multi-plugin use) are prefixed: `cedros-login:{id}`.\n */\nexport const CEDROS_LOGIN_SECTION_IDS = {\n users: 'users',\n team: 'team',\n deposits: 'deposits',\n withdrawals: 'withdrawals',\n settingsAuth: 'settings-auth',\n settingsEmail: 'settings-email',\n settingsWebhooks: 'settings-webhooks',\n settingsWallet: 'settings-wallet',\n settingsCredits: 'settings-credits',\n settingsServer: 'settings-server',\n} as const;\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","CEDROS_LOGIN_SECTION_IDS"],"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,EAAAC,EAAU,MAAM;AACd,aAASC,EAAmBC,GAAmB;AAC7C,MAAIJ,EAAY,WAAW,CAACA,EAAY,QAAQ,SAASI,EAAM,MAAc,KAC3EN,EAAU,EAAK;AAAA,IAEnB;AAEA,QAAID;AACF,sBAAS,iBAAiB,aAAaM,CAAkB,GAClD,MAAM,SAAS,oBAAoB,aAAaA,CAAkB;AAAA,EAE7E,GAAG,CAACN,CAAM,CAAC,GAGXK,EAAU,MAAM;AACd,aAASG,EAAaD,GAAsB;AAC1C,MAAIA,EAAM,QAAQ,YAChBN,EAAU,EAAK;AAAA,IAEnB;AAEA,QAAID;AACF,sBAAS,iBAAiB,WAAWQ,CAAY,GAC1C,MAAM,SAAS,oBAAoB,WAAWA,CAAY;AAAA,EAErE,GAAG,CAACR,CAAM,CAAC;AAEX,QAAMS,IAAiBC,EAAY,MAAM;AACvC,IAAAT,EAAU,EAAK,GACfJ,IAAA;AAAA,EACF,GAAG,CAACA,CAAU,CAAC,GAETc,IAAeD,EAAY,MAAM;AACrC,IAAAT,E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AAA,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,GAaaE,KAA2B;AAAA,EACtC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,gBAAgB;AAClB;"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./useAuth-B1yS_YiD.cjs"),r=require("./useCedrosLogin-DtJorrE7.cjs"),e=require("./SolanaLoginButton-CqdzSSeJ.cjs"),n=require("./LoadingSpinner-d6sSxgQN.cjs"),i=require("./ErrorMessage-CHbYbVi2.cjs");exports.CedrosLoginProvider=o.CedrosLoginProvider;exports.useAuth=o.useAuth;exports.useCedrosLogin=r.useCedrosLogin;exports.SolanaLoginButton=e.SolanaLoginButton;exports.registerMobileWallet=e.registerMobileWallet;exports.useSolanaAuth=e.useSolanaAuth;exports.LoadingSpinner=n.LoadingSpinner;exports.ErrorMessage=i.ErrorMessage;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./useAuth-2vgrAH-M.cjs"),r=require("./useCedrosLogin-DtJorrE7.cjs"),e=require("./SolanaLoginButton-2504p6cr.cjs"),n=require("./LoadingSpinner-d6sSxgQN.cjs"),i=require("./ErrorMessage-CHbYbVi2.cjs");exports.CedrosLoginProvider=o.CedrosLoginProvider;exports.useAuth=o.useAuth;exports.useCedrosLogin=r.useCedrosLogin;exports.SolanaLoginButton=e.SolanaLoginButton;exports.registerMobileWallet=e.registerMobileWallet;exports.useSolanaAuth=e.useSolanaAuth;exports.LoadingSpinner=n.LoadingSpinner;exports.ErrorMessage=i.ErrorMessage;
@@ -166,6 +166,8 @@ export declare interface CedrosLoginConfig {
166
166
  theme?: ThemeMode;
167
167
  /** CSS variable overrides for custom theming */
168
168
  themeOverrides?: ThemeOverrides;
169
+ /** Disable all default cedros styles. Use for custom design systems. */
170
+ unstyled?: boolean;
169
171
  /** API request timeout in ms. Default: 10000 */
170
172
  requestTimeout?: number;
171
173
  /** Retry attempts on transient errors. Default: 2 */
@@ -501,6 +503,8 @@ declare interface SolanaLoginButtonProps {
501
503
  hideIfNoWallet?: boolean;
502
504
  /** Called when the button's loading state changes (connecting, signing, etc.). */
503
505
  onLoadingChange?: (loading: boolean) => void;
506
+ /** Access code forwarded to the server when this flow creates a new account. */
507
+ accessCode?: string;
504
508
  /**
505
509
  * Solana wallet adapter context. Pass this from @solana/wallet-adapter-react's useWallet().
506
510
  * When provided, the component assumes a WalletProvider exists in the React tree and
@@ -678,7 +682,8 @@ export declare function useSolanaAuth(): UseSolanaAuthReturn;
678
682
 
679
683
  declare interface UseSolanaAuthReturn {
680
684
  requestChallenge: (publicKey: string) => Promise<ChallengeResponse>;
681
- signIn: (publicKey: string, signature: string, message: string) => Promise<AuthResponse>;
685
+ /** @param accessCode Optional signup access code, forwarded to the server on new registrations. */
686
+ signIn: (publicKey: string, signature: string, message: string, accessCode?: string) => Promise<AuthResponse>;
682
687
  isLoading: boolean;
683
688
  error: AuthError | null;
684
689
  clearError: () => void;
@@ -1,6 +1,6 @@
1
- import { C as e, u as s } from "./useAuth-l-itM5am.js";
1
+ import { C as e, u as s } from "./useAuth-CNflw856.js";
2
2
  import { u as t } from "./useCedrosLogin-CFfID-0i.js";
3
- import { S as u, r as i, u as g } from "./SolanaLoginButton-CyeX35eU.js";
3
+ import { S as u, r as i, u as g } from "./SolanaLoginButton-C7Kc_m6n.js";
4
4
  import { L as f } from "./LoadingSpinner-6vml-zwr.js";
5
5
  import { E as m } from "./ErrorMessage-CcEK0pYO.js";
6
6
  export {
@@ -0,0 +1 @@
1
+ "use strict";const L=require("react/jsx-runtime"),o=require("react"),Ae=require("./LoadingSpinner-d6sSxgQN.cjs"),F=require("./useCedrosLogin-DtJorrE7.cjs");let Z=0;function Ee({theme:e,themeOverrides:t}){const A=o.useMemo(()=>typeof window>"u"?!1:e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches,[e]);o.useEffect(()=>{if(typeof document>"u")return;const n=document.documentElement;let I=!1;return A?(Z++,I=!0,n.classList.add("cedros-dark")):Z===0&&n.classList.remove("cedros-dark"),()=>{I&&(Z--,Z===0&&n.classList.remove("cedros-dark"))}},[A]);const i=A?"cedros-dark":"",r=o.useMemo(()=>{if(!t)return{};const n={};for(const[I,c]of Object.entries(t))c&&(n[I]=c);return n},[t]);return{className:i,style:r}}const He={email:!0,google:!0,apple:!0,solana:!0,webauthn:!0,instantLink:!0};function Je(e,t,A){const[i,r]=o.useState(null),[n,I]=o.useState(),[c,u]=o.useState(),[s,p]=o.useState(),[y,B]=o.useState(),[b,U]=o.useState(),[C,d]=o.useState(),[w,m]=o.useState(t),k=o.useRef(!1);return o.useEffect(()=>{if(!t||k.current)return;k.current=!0,new F.ApiClient({baseUrl:e,timeoutMs:A??5e3,retryAttempts:1}).get("/features",{credentials:"omit"}).then(h=>{r({email:h.email,google:h.google,apple:h.apple,solana:h.solana,webauthn:h.webauthn,instantLink:h.instantLink}),I(h.googleClientId),u(h.appleClientId),p(h.usernameEnabled),B(h.walletEnrollEnabled),U(h.showRecoveryEnabled),d(h.socialButtonOrder)}).catch(()=>{r(He)}).finally(()=>{m(!1)})},[t,e,A]),{features:i,googleClientId:n,appleClientId:c,usernameEnabled:s,walletEnrollEnabled:y,showRecoveryEnabled:b,socialButtonOrder:C,isLoading:w}}const Me="cedros_tokens",Ve=6e4;class Ne{storage;requestedStorage;storageKey;tokens=null;expiresAt=0;refreshTimer=null;onRefreshNeeded=null;onSessionExpired=null;onRefreshError=null;isDestroyed=!1;sessionExpiredFired=!1;allowWebStorage;constructor(t="cookie",A=Me,i={}){this.requestedStorage=t,this.storage=t,this.storageKey=A,this.allowWebStorage=i.allowWebStorage??!1,this.warnIfLocalStorage(),!this.allowWebStorage&&(this.requestedStorage==="localStorage"||this.requestedStorage==="sessionStorage")&&(this.storage="memory"),this.loadFromStorage()}warnIfLocalStorage(){if((this.requestedStorage==="localStorage"||this.requestedStorage==="sessionStorage")&&typeof console<"u"){const t=this.allowWebStorage?"":" (web storage disabled by default; set allowWebStorage=true to enable)";console.warn("[cedros-login] SECURITY: Using web storage for token storage. Tokens are vulnerable to XSS attacks."+t+" PRODUCTION RECOMMENDATIONS: (1) Use httpOnly cookie storage instead, (2) If web storage required: implement strict Content-Security-Policy, sanitize all input/output, audit third-party scripts. See https://owasp.org/www-community/attacks/xss/")}}setRefreshCallback(t){this.onRefreshNeeded=t,this.scheduleRefresh()}setSessionExpiredCallback(t){this.onSessionExpired=t}setRefreshErrorCallback(t){this.onRefreshError=t}setTokens(t){this.tokens=t,this.expiresAt=Date.now()+t.expiresIn*1e3,this.sessionExpiredFired=!1,this.saveToStorage(),this.scheduleRefresh()}getAccessToken(){if(this.isDestroyed)return null;const t=this.tokens?.accessToken;return t?Date.now()>=this.expiresAt?(this.clear(),this.fireSessionExpired(),null):t:null}getRefreshToken(){return this.tokens?.refreshToken??null}clear(){this.tokens=null,this.expiresAt=0,this.cancelRefresh(),this.clearStorage()}hasTokens(){return this.tokens!==null&&Date.now()<this.expiresAt}destroy(){this.isDestroyed=!0,this.cancelRefresh(),this.clearStorage(),this.onRefreshNeeded=null,this.onSessionExpired=null,this.onRefreshError=null,this.tokens=null}getTimeUntilExpiry(){return this.tokens?Math.max(0,this.expiresAt-Date.now()):0}fireSessionExpired(){this.sessionExpiredFired||(this.sessionExpiredFired=!0,this.onSessionExpired?.())}scheduleRefresh(){if(this.cancelRefresh(),!this.tokens||!this.onRefreshNeeded)return;const t=this.getTimeUntilExpiry(),A=Math.max(0,t-Ve);if(A<=0){if(this.isDestroyed)return;this.onRefreshNeeded().catch(i=>{if(this.isDestroyed)return;const r=i instanceof Error?i:new Error("Token refresh failed");this.onRefreshError?.(r),this.clear(),this.fireSessionExpired()});return}this.refreshTimer=setTimeout(()=>{this.isDestroyed||this.onRefreshNeeded?.().catch(i=>{if(this.isDestroyed)return;const r=i instanceof Error?i:new Error("Token refresh failed");this.onRefreshError?.(r),this.clear(),this.fireSessionExpired()})},A)}cancelRefresh(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null)}loadFromStorage(){if(this.storage!=="memory"&&!(typeof window>"u")&&!(!this.allowWebStorage&&(this.storage==="localStorage"||this.storage==="sessionStorage")))try{if(this.storage==="localStorage"||this.storage==="sessionStorage"){const t=this.storage==="localStorage"?localStorage:sessionStorage,A=t.getItem(this.storageKey);if(A){const i=JSON.parse(A);this.isValidStoredTokenData(i)?i.expiresAt>Date.now()?(this.tokens=i.tokens,this.expiresAt=i.expiresAt):t.removeItem(this.storageKey):t.removeItem(this.storageKey)}}}catch{if(this.storage==="localStorage"||this.storage==="sessionStorage"){const t=this.storage==="localStorage"?localStorage:sessionStorage;try{t.removeItem(this.storageKey)}catch{}}}}isValidStoredTokenData(t){if(typeof t!="object"||t===null)return!1;const A=t;if(typeof A.expiresAt!="number"||typeof A.tokens!="object"||A.tokens===null)return!1;const i=A.tokens;return!(typeof i.accessToken!="string"||typeof i.refreshToken!="string"||typeof i.expiresIn!="number")}saveToStorage(){if(!(this.storage==="memory"||!this.tokens)&&!(typeof window>"u")&&!(!this.allowWebStorage&&(this.storage==="localStorage"||this.storage==="sessionStorage")))try{if(this.storage==="localStorage"||this.storage==="sessionStorage"){const t=this.storage==="localStorage"?localStorage:sessionStorage,A={tokens:this.tokens,expiresAt:this.expiresAt};t.setItem(this.storageKey,JSON.stringify(A))}}catch{}}clearStorage(){if(this.storage!=="memory"&&!(typeof window>"u")&&!(!this.allowWebStorage&&(this.storage==="localStorage"||this.storage==="sessionStorage")))try{(this.storage==="localStorage"||this.storage==="sessionStorage")&&(this.storage==="localStorage"?localStorage:sessionStorage).removeItem(this.storageKey)}catch{}}}const Pe="cedros_auth_sync";class Ye{channel=null;callback=null;boundHandler=null;constructor(){typeof window<"u"&&"BroadcastChannel"in window&&(this.channel=new BroadcastChannel(Pe),this.boundHandler=this.handleMessage.bind(this),this.channel.addEventListener("message",this.boundHandler))}handleMessage(t){const A=t.data;if(!(!A||typeof A!="object"||typeof A.type!="string")&&["login","logout","refresh"].includes(A.type)){if(A.type==="login"){const i=A;if(typeof i.user!="object"||i.user===null||typeof i.user.id!="string")return}this.callback?.(A)}}setCallback(t){this.callback=t}broadcastLogin(t){this.channel?.postMessage({type:"login",user:t})}broadcastLogout(){this.channel?.postMessage({type:"logout"})}broadcastRefresh(){this.channel?.postMessage({type:"refresh"})}close(){this.channel&&(this.boundHandler&&(this.channel.removeEventListener("message",this.boundHandler),this.boundHandler=null),this.channel.close(),this.channel=null),this.callback=null}}function q(e){if(typeof e!="object"||e===null)return!1;const t=e;if(typeof t.user!="object"||t.user===null)return!1;const A=t.user;return typeof A.id=="string"&&A.id.length>0}function Oe(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.accessToken=="string"&&t.accessToken.length>0&&typeof t.refreshToken=="string"&&t.refreshToken.length>0&&typeof t.expiresIn=="number"&&t.expiresIn>0}function ve({serverUrl:e,session:t,callbacks:A,requestTimeoutMs:i}){const[r,n]=o.useState(null),[I,c]=o.useState("idle"),u=o.useRef(null),s=o.useRef(null),p=o.useRef(A),y=o.useRef(!0),B=o.useRef(null),b=o.useRef(()=>Promise.resolve()),U=o.useRef(()=>{});o.useEffect(()=>{p.current=A},[A]),o.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]);const C=o.useCallback(f=>{y.current&&n(f)},[]),d=o.useCallback(f=>{y.current&&c(f)},[]),w=o.useMemo(()=>({storage:t?.storage??"cookie",autoRefresh:t?.autoRefresh??!0,syncTabs:t?.syncTabs??!0,persistKey:t?.persistKey,allowWebStorage:t?.allowWebStorage??!1}),[t?.storage,t?.autoRefresh,t?.syncTabs,t?.persistKey,t?.allowWebStorage]);o.useEffect(()=>{const f=new Ne(w.storage,w.persistKey,{allowWebStorage:w.allowWebStorage});return u.current=f,w.autoRefresh&&f.setRefreshCallback(()=>b.current()),f.setSessionExpiredCallback(()=>U.current()),w.syncTabs&&(s.current=new Ye),()=>{f.destroy(),u.current=null,s.current?.close()}},[w.storage,w.syncTabs,w.persistKey,w.allowWebStorage,w.autoRefresh]);const m=o.useCallback(async()=>{if(B.current)return B.current;const f=u.current?.getRefreshToken(),S=!!f,G=F.getCsrfToken(),H={};S&&(H["Content-Type"]="application/json"),G&&(H["X-CSRF-Token"]=G);let K,J;const M=new Promise((O,T)=>{K=O,J=T});B.current=M,(async()=>{const O=new AbortController,T=i??1e4,N=window.setTimeout(()=>O.abort(),T);try{const v=await fetch(`${e}/refresh`,{method:"POST",headers:Object.keys(H).length>0?H:void 0,credentials:"include",body:S?JSON.stringify({refreshToken:f}):void 0,signal:O.signal});if(!v.ok)throw new Error("Token refresh failed");const te=await v.json();if(te.tokens){if(!Oe(te.tokens))throw new Error("Invalid token response structure");u.current?.setTokens(te.tokens)}else if(w.storage!=="cookie")throw new Error("Token refresh failed");s.current?.broadcastRefresh(),K()}catch(v){throw J(v),v}finally{window.clearTimeout(N)}})().catch(()=>{});try{await M}finally{B.current=null}},[e,w.storage,i]),k=o.useCallback(()=>{if(w.storage==="cookie")return;const f=u.current?.getAccessToken();if(f)return{Authorization:`Bearer ${f}`}},[w.storage]),E=o.useCallback(()=>{u.current?.clear(),C(null),d("unauthenticated"),p.current?.onSessionExpired?.()},[d,C]);b.current=m,U.current=E;const h=o.useCallback(f=>{const S=new AbortController,G=i??1e4,H=window.setTimeout(()=>S.abort(),G),K={},J=k();J&&Object.assign(K,J);const M=F.getCsrfToken();return M&&(K["X-CSRF-Token"]=M),{promise:fetch(f,{credentials:"include",headers:Object.keys(K).length>0?K:void 0,signal:S.signal}),cleanup:()=>window.clearTimeout(H)}},[k,i]),g=o.useCallback(async()=>{const f=h(`${e}/user`);try{const S=await f.promise;if(S.ok){const G=await S.json();if(q(G)){C(G.user),d("authenticated");return}}if(S.status===401&&w.autoRefresh){try{await m()}catch{E();return}const G=h(`${e}/user`);try{const H=await G.promise;if(H.ok){const K=await H.json();if(q(K)){C(K.user),d("authenticated");return}}}finally{G.cleanup()}}C(null),d("unauthenticated")}catch{C(null),d("unauthenticated")}finally{f.cleanup()}},[e,w.autoRefresh,m,h,E,d,C]);o.useEffect(()=>{!s.current||!w.syncTabs||s.current.setCallback(f=>{switch(f.type){case"login":C(f.user),d("authenticated");break;case"logout":C(null),d("unauthenticated"),u.current?.clear();break;case"refresh":g();break;default:console.warn("[Cedros Login] Unhandled tab sync event:",f)}})},[w.syncTabs,g,d,C]),o.useEffect(()=>{const f=new AbortController,S=i??1e4,G=window.setTimeout(()=>f.abort(),S);return(async()=>{d("loading");try{const K=await fetch(`${e}/user`,{credentials:"include",headers:k(),signal:f.signal});if(K.ok){const J=await K.json();if(q(J)){C(J.user),d("authenticated");return}}if(K.status===401&&w.autoRefresh){try{await m()}catch{E();return}const J=await fetch(`${e}/user`,{credentials:"include",headers:k(),signal:f.signal});if(J.ok){const M=await J.json();if(q(M)){C(M.user),d("authenticated");return}}}C(null),d("unauthenticated")}catch{C(null),d("unauthenticated")}})(),()=>{window.clearTimeout(G),f.abort()}},[e,w.autoRefresh,m,k,E,d,C,i]);const a=o.useCallback((f,S)=>{C(f),d("authenticated"),S&&u.current?.setTokens(S),y.current&&s.current?.broadcastLogin(f)},[C,d]),l=o.useCallback(async()=>{const f=F.getCsrfToken(),S=new AbortController,G=i??1e4,H=window.setTimeout(()=>S.abort(),G);try{await fetch(`${e}/logout`,{method:"POST",headers:{...f?{"X-CSRF-Token":f}:{},...k()??{}},credentials:"include",signal:S.signal})}catch{}finally{window.clearTimeout(H),C(null),d("unauthenticated"),u.current?.clear(),s.current?.broadcastLogout(),p.current?.onLogout?.()}},[e,k,C,d,i]),Q=o.useCallback(()=>u.current?.getAccessToken()??null,[]);return{user:r,authState:I,handleLoginSuccess:a,logout:l,refreshUser:g,getAccessToken:Q}}const pe={mCost:19456,tCost:2,pCost:1};function xe(e){return e.length===16}function Re(e){if(e.length===16)return!0;if(e.length<18)return!1;const t=e[0];return t===0||t===1||t===128||t===8}function Te(e){return e.length===32}function Le(e){return e.length===12}function Xe(e){return e.length>=16}function We(e){return e.length===32}function ye(e){if(!xe(e))throw new Error(`Invalid seed length: expected 16, got ${e.length}`);return e}function je(e){if(!Re(e))throw new Error(`Invalid share length: expected >=16, got ${e.length}`);return e}function Ce(e){if(!Te(e))throw new Error(`Invalid key length: expected 32, got ${e.length}`);return e}function Ze(e){if(!Le(e))throw new Error(`Invalid nonce length: expected 12, got ${e.length}`);return e}function qe(e){if(!Xe(e))throw new Error(`Invalid salt length: expected >=16, got ${e.length}`);return e}function _e(e){if(!We(e))throw new Error(`Invalid PRF salt length: expected 32, got ${e.length}`);return e}function R(e){return new Uint8Array(e)}function z(e){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("WebCrypto API not available. Secure random generation requires a modern browser.");const t=new Uint8Array(e);return crypto.getRandomValues(t),t}function $e(){return ye(z(16))}function ze(){return Ze(z(12))}function et(){return qe(z(16))}function tt(){return _e(z(32))}function he(e){if(!(!e||e.length===0)){if(typeof globalThis.crypto?.getRandomValues=="function")globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=t*90&255;e.fill(0)}}function At(...e){for(const t of e)t&&he(t)}async function it(e){return crypto.subtle.importKey("raw",R(e),{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function rt(e,t,A){const i=A??ze(),r=await it(t),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:R(i)},r,R(e));return{ciphertext:new Uint8Array(n),nonce:i}}async function nt(e,t){const A=await rt(e,t);return{ciphertext:ae(A.ciphertext),nonce:ae(A.nonce)}}function ae(e){const A=[];for(let i=0;i<e.length;i+=32768){const r=e.subarray(i,Math.min(i+32768,e.length));A.push(String.fromCharCode(...r))}return btoa(A.join(""))}function ke(e){let t;try{t=atob(e)}catch{throw new Error("Invalid base64 string: input is malformed or contains invalid characters")}const A=new Uint8Array(t.length);for(let i=0;i<t.length;i++)A[i]=t.charCodeAt(i);return A}async function ot(e,t,A,i=32){const r=await crypto.subtle.importKey("raw",R(e),"HKDF",!1,["deriveBits"]),n=new TextEncoder().encode(A),I=await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:R(t??new Uint8Array(32)),info:R(n)},r,i*8);return new Uint8Array(I)}async function st(e,t){const A=await ot(e,t,"cedros-wallet-share-b-encryption",32);return Ce(A)}async function It(){try{const e=await crypto.subtle.importKey("raw",new Uint8Array(32),"HKDF",!1,["deriveBits"]);return await crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(32),info:new Uint8Array(0)},e,256),!0}catch{return!1}}function x(e,t,A,i){function r(n){return n instanceof A?n:new A(function(I){I(n)})}return new(A||(A=Promise))(function(n,I){function c(p){try{s(i.next(p))}catch(y){I(y)}}function u(p){try{s(i.throw(p))}catch(y){I(y)}}function s(p){p.done?n(p.value):r(p.value).then(c,u)}s((i=i.apply(e,[])).next())})}class D{constructor(){this.mutex=Promise.resolve()}lock(){let t=()=>{};return this.mutex=this.mutex.then(()=>new Promise(t)),new Promise(A=>{t=A})}dispatch(t){return x(this,void 0,void 0,function*(){const A=yield this.lock();try{return yield Promise.resolve(t())}finally{A()}})}}var ie;function at(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global}const ge=at(),re=(ie=ge.Buffer)!==null&&ie!==void 0?ie:null,gt=ge.TextEncoder?new ge.TextEncoder:null;function Se(e,t){return(e&15)+(e>>6|e>>3&8)<<4|(t&15)+(t>>6|t>>3&8)}function De(e,t){const A=t.length>>1;for(let i=0;i<A;i++){const r=i<<1;e[i]=Se(t.charCodeAt(r),t.charCodeAt(r+1))}}function lt(e,t){if(e.length!==t.length*2)return!1;for(let A=0;A<t.length;A++){const i=A<<1;if(t[A]!==Se(e.charCodeAt(i),e.charCodeAt(i+1)))return!1}return!0}const fe=87,we=48;function le(e,t,A){let i=0;for(let r=0;r<A;r++){let n=t[r]>>>4;e[i++]=n>9?n+fe:n+we,n=t[r]&15,e[i++]=n>9?n+fe:n+we}return String.fromCharCode.apply(null,e)}const Y=re!==null?e=>{if(typeof e=="string"){const t=re.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(re.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if(typeof e=="string")return gt.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",W=new Uint8Array(256);for(let e=0;e<V.length;e++)W[V.charCodeAt(e)]=e;function Qe(e,t=!0){const A=e.length,i=A%3,r=[],n=A-i;for(let I=0;I<n;I+=3){const c=(e[I]<<16&16711680)+(e[I+1]<<8&65280)+(e[I+2]&255),u=V.charAt(c>>18&63)+V.charAt(c>>12&63)+V.charAt(c>>6&63)+V.charAt(c&63);r.push(u)}if(i===1){const I=e[A-1],c=V.charAt(I>>2),u=V.charAt(I<<4&63);r.push(`${c}${u}`),t&&r.push("==")}else if(i===2){const I=(e[A-2]<<8)+e[A-1],c=V.charAt(I>>10),u=V.charAt(I>>4&63),s=V.charAt(I<<2&63);r.push(`${c}${u}${s}`),t&&r.push("=")}return r.join("")}function ct(e){let t=Math.floor(e.length*.75);const A=e.length;return e[A-1]==="="&&(t-=1,e[A-2]==="="&&(t-=1)),t}function Ct(e){const t=ct(e),A=e.length,i=new Uint8Array(t);let r=0;for(let n=0;n<A;n+=4){const I=W[e.charCodeAt(n)],c=W[e.charCodeAt(n+1)],u=W[e.charCodeAt(n+2)],s=W[e.charCodeAt(n+3)];i[r]=I<<2|c>>4,r+=1,i[r]=(c&15)<<4|u>>2,r+=1,i[r]=(u&3)<<6|s&63,r+=1}return i}const _=16*1024,X=4,ht=new D,ne=new Map;function Fe(e,t){return x(this,void 0,void 0,function*(){let A=null,i=null,r=!1;if(typeof WebAssembly>"u")throw new Error("WebAssembly is not supported in this environment!");const n=(g,a=0)=>{i.set(g,a)},I=()=>i,c=()=>A.exports,u=g=>{A.exports.Hash_SetMemorySize(g);const a=A.exports.Hash_GetBuffer(),l=A.exports.memory.buffer;i=new Uint8Array(l,a,g)},s=()=>new DataView(A.exports.memory.buffer).getUint32(A.exports.STATE_SIZE,!0),p=ht.dispatch(()=>x(this,void 0,void 0,function*(){if(!ne.has(e.name)){const a=Ct(e.data),l=WebAssembly.compile(a);ne.set(e.name,l)}const g=yield ne.get(e.name);A=yield WebAssembly.instantiate(g,{})})),y=()=>x(this,void 0,void 0,function*(){A||(yield p);const g=A.exports.Hash_GetBuffer(),a=A.exports.memory.buffer;i=new Uint8Array(a,g,_)}),B=(g=null)=>{r=!0,A.exports.Hash_Init(g)},b=g=>{let a=0;for(;a<g.length;){const l=g.subarray(a,a+_);a+=l.length,i.set(l),A.exports.Hash_Update(l.length)}},U=g=>{if(!r)throw new Error("update() called before init()");const a=Y(g);b(a)},C=new Uint8Array(t*2),d=(g,a=null)=>{if(!r)throw new Error("digest() called before init()");return r=!1,A.exports.Hash_Final(a),g==="binary"?i.slice(0,t):le(C,i,t)},w=()=>{if(!r)throw new Error("save() can only be called after init() and before digest()");const g=A.exports.Hash_GetState(),a=s(),l=A.exports.memory.buffer,Q=new Uint8Array(l,g,a),f=new Uint8Array(X+a);return De(f,e.hash),f.set(Q,X),f},m=g=>{if(!(g instanceof Uint8Array))throw new Error("load() expects an Uint8Array generated by save()");const a=A.exports.Hash_GetState(),l=s(),Q=X+l,f=A.exports.memory.buffer;if(g.length!==Q)throw new Error(`Bad state length (expected ${Q} bytes, got ${g.length})`);if(!lt(e.hash,g.subarray(0,X)))throw new Error("This state was written by an incompatible hash implementation");const S=g.subarray(X);new Uint8Array(f,a,l).set(S),r=!0},k=g=>typeof g=="string"?g.length<_/4:g.byteLength<_;let E=k;switch(e.name){case"argon2":case"scrypt":E=()=>!0;break;case"blake2b":case"blake2s":E=(g,a)=>a<=512&&k(g);break;case"blake3":E=(g,a)=>a===0&&k(g);break;case"xxhash64":case"xxhash3":case"xxhash128":case"crc64":E=()=>!1;break}const h=(g,a=null,l=null)=>{if(!E(g,a))return B(a),U(g),d("hex",l);const Q=Y(g);return i.set(Q),A.exports.Hash_Calculate(Q.length,a,l),le(C,i,t)};return yield y(),{getMemory:I,writeMemory:n,getExports:c,setMemorySize:u,init:B,update:U,digest:d,save:w,load:m,calculate:h,hashLength:t}})}new D;var ut="argon2",ft="AGFzbQEAAAABKQVgAX8Bf2AAAX9gEH9/f39/f39/f39/f39/f38AYAR/f39/AGACf38AAwYFAAECAwQFBgEBAoCAAgYIAX8BQZCoBAsHQQQGbWVtb3J5AgASSGFzaF9TZXRNZW1vcnlTaXplAAAOSGFzaF9HZXRCdWZmZXIAAQ5IYXNoX0NhbGN1bGF0ZQAECvEyBVgBAn9BACEBAkAgAEEAKAKICCICRg0AAkAgACACayIAQRB2IABBgIB8cSAASWoiAEAAQX9HDQBB/wHADwtBACEBQQBBACkDiAggAEEQdK18NwOICAsgAcALcAECfwJAQQAoAoAIIgANAEEAPwBBEHQiADYCgAhBACgCiAgiAUGAgCBGDQACQEGAgCAgAWsiAEEQdiAAQYCAfHEgAElqIgBAAEF/Rw0AQQAPC0EAQQApA4gIIABBEHStfDcDiAhBACgCgAghAAsgAAvcDgECfiAAIAQpAwAiECAAKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAMIBAgDCkDAIVCIIkiEDcDACAIIBAgCCkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgBCAQIAQpAwCFQiiJIhA3AwAgACAQIAApAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAwgECAMKQMAhUIwiSIQNwMAIAggECAIKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAEIBAgBCkDAIVCAYk3AwAgASAFKQMAIhAgASkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDSAQIA0pAwCFQiCJIhA3AwAgCSAQIAkpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAUgECAFKQMAhUIoiSIQNwMAIAEgECABKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACANIBAgDSkDAIVCMIkiEDcDACAJIBAgCSkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBSAQIAUpAwCFQgGJNwMAIAIgBikDACIQIAIpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIA4gECAOKQMAhUIgiSIQNwMAIAogECAKKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAGIBAgBikDAIVCKIkiEDcDACACIBAgAikDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgDiAQIA4pAwCFQjCJIhA3AwAgCiAQIAopAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAYgECAGKQMAhUIBiTcDACADIAcpAwAiECADKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAPIBAgDykDAIVCIIkiEDcDACALIBAgCykDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgByAQIAcpAwCFQiiJIhA3AwAgAyAQIAMpAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIA8gECAPKQMAhUIwiSIQNwMAIAsgECALKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAHIBAgBykDAIVCAYk3AwAgACAFKQMAIhAgACkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDyAQIA8pAwCFQiCJIhA3AwAgCiAQIAopAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAUgECAFKQMAhUIoiSIQNwMAIAAgECAAKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAPIBAgDykDAIVCMIkiEDcDACAKIBAgCikDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBSAQIAUpAwCFQgGJNwMAIAEgBikDACIQIAEpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAwgECAMKQMAhUIgiSIQNwMAIAsgECALKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACAGIBAgBikDAIVCKIkiEDcDACABIBAgASkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgDCAQIAwpAwCFQjCJIhA3AwAgCyAQIAspAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIAYgECAGKQMAhUIBiTcDACACIAcpAwAiECACKQMAIhF8IBFCAYZC/v///x+DIBBC/////w+DfnwiEDcDACANIBAgDSkDAIVCIIkiEDcDACAIIBAgCCkDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgByAQIAcpAwCFQiiJIhA3AwAgAiAQIAIpAwAiEXwgEEL/////D4MgEUIBhkL+////H4N+fCIQNwMAIA0gECANKQMAhUIwiSIQNwMAIAggECAIKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAHIBAgBykDAIVCAYk3AwAgAyAEKQMAIhAgAykDACIRfCARQgGGQv7///8fgyAQQv////8Pg358IhA3AwAgDiAQIA4pAwCFQiCJIhA3AwAgCSAQIAkpAwAiEXwgEUIBhkL+////H4MgEEL/////D4N+fCIQNwMAIAQgECAEKQMAhUIoiSIQNwMAIAMgECADKQMAIhF8IBBC/////w+DIBFCAYZC/v///x+DfnwiEDcDACAOIBAgDikDAIVCMIkiEDcDACAJIBAgCSkDACIRfCAQQv////8PgyARQgGGQv7///8fg358IhA3AwAgBCAQIAQpAwCFQgGJNwMAC98aAQN/QQAhBEEAIAIpAwAgASkDAIU3A5AIQQAgAikDCCABKQMIhTcDmAhBACACKQMQIAEpAxCFNwOgCEEAIAIpAxggASkDGIU3A6gIQQAgAikDICABKQMghTcDsAhBACACKQMoIAEpAyiFNwO4CEEAIAIpAzAgASkDMIU3A8AIQQAgAikDOCABKQM4hTcDyAhBACACKQNAIAEpA0CFNwPQCEEAIAIpA0ggASkDSIU3A9gIQQAgAikDUCABKQNQhTcD4AhBACACKQNYIAEpA1iFNwPoCEEAIAIpA2AgASkDYIU3A/AIQQAgAikDaCABKQNohTcD+AhBACACKQNwIAEpA3CFNwOACUEAIAIpA3ggASkDeIU3A4gJQQAgAikDgAEgASkDgAGFNwOQCUEAIAIpA4gBIAEpA4gBhTcDmAlBACACKQOQASABKQOQAYU3A6AJQQAgAikDmAEgASkDmAGFNwOoCUEAIAIpA6ABIAEpA6ABhTcDsAlBACACKQOoASABKQOoAYU3A7gJQQAgAikDsAEgASkDsAGFNwPACUEAIAIpA7gBIAEpA7gBhTcDyAlBACACKQPAASABKQPAAYU3A9AJQQAgAikDyAEgASkDyAGFNwPYCUEAIAIpA9ABIAEpA9ABhTcD4AlBACACKQPYASABKQPYAYU3A+gJQQAgAikD4AEgASkD4AGFNwPwCUEAIAIpA+gBIAEpA+gBhTcD+AlBACACKQPwASABKQPwAYU3A4AKQQAgAikD+AEgASkD+AGFNwOICkEAIAIpA4ACIAEpA4AChTcDkApBACACKQOIAiABKQOIAoU3A5gKQQAg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",pt={name:Bt,data:dt,hash:Et};new D;function Be(e){return!Number.isInteger(e)||e<8||e>512||e%8!==0?new Error("Invalid variant! Valid values: 8, 16, ..., 512"):null}function yt(e,t){return e|t<<16}function ce(e=512,t=null){if(Be(e))return Promise.reject(Be(e));let A=null,i=e;if(t!==null){if(A=Y(t),A.length>64)return Promise.reject(new Error("Max key length is 64 bytes"));i=yt(e,A.length)}const r=e/8;return Fe(pt,r).then(n=>{i>512&&n.writeMemory(A),n.init(i);const I={init:i>512?()=>(n.writeMemory(A),n.init(i),I):()=>(n.init(i),I),update:c=>(n.update(c),I),digest:c=>n.digest(c),save:()=>n.save(),load:c=>(n.load(c),I),blockSize:128,digestSize:r};return I})}function kt(e,t,A){const i=[`m=${t.memorySize}`,`t=${t.iterations}`,`p=${t.parallelism}`].join(",");return`$argon2${t.hashType}$v=19$${i}$${Qe(e,!1)}$${Qe(A,!1)}`}const de=new DataView(new ArrayBuffer(4));function P(e){return de.setInt32(0,e,!0),new Uint8Array(de.buffer)}function oe(e,t,A){return x(this,void 0,void 0,function*(){if(A<=64){const u=yield ce(A*8);return u.update(P(A)),u.update(t),u.digest("binary")}const i=Math.ceil(A/32)-2,r=new Uint8Array(A);e.init(),e.update(P(A)),e.update(t);let n=e.digest("binary");r.set(n.subarray(0,32),0);for(let u=1;u<i;u++)e.init(),e.update(n),n=e.digest("binary"),r.set(n.subarray(0,32),u*32);const I=A-32*i;let c;return I===64?(c=e,c.init()):c=yield ce(I*8),c.update(n),n=c.digest("binary"),r.set(n.subarray(0,I),i*32),r})}function St(e){switch(e){case"d":return 0;case"i":return 1;default:return 2}}function Dt(e){return x(this,void 0,void 0,function*(){var t;const{parallelism:A,iterations:i,hashLength:r}=e,n=Y(e.password),I=Y(e.salt),c=19,u=St(e.hashType),{memorySize:s}=e,p=Y((t=e.secret)!==null&&t!==void 0?t:""),[y,B]=yield Promise.all([Fe(Qt,1024),ce(512)]);y.setMemorySize(s*1024+1024);const b=new Uint8Array(24),U=new DataView(b.buffer);U.setInt32(0,A,!0),U.setInt32(4,r,!0),U.setInt32(8,s,!0),U.setInt32(12,i,!0),U.setInt32(16,c,!0),U.setInt32(20,u,!0),y.writeMemory(b,s*1024),B.init(),B.update(b),B.update(P(n.length)),B.update(n),B.update(P(I.length)),B.update(I),B.update(P(p.length)),B.update(p),B.update(P(0));const d=Math.floor(s/(A*4))*4,w=new Uint8Array(72),m=B.digest("binary");w.set(m);for(let h=0;h<A;h++){w.set(P(0),64),w.set(P(h),68);let g=h*d,a=yield oe(B,w,1024);y.writeMemory(a,g*1024),g+=1,w.set(P(1),64),a=yield oe(B,w,1024),y.writeMemory(a,g*1024)}const k=new Uint8Array(1024);De(k,y.calculate(new Uint8Array([]),s));const E=yield oe(B,k,r);if(e.outputType==="hex"){const h=new Uint8Array(r*2);return le(h,E,r)}return e.outputType==="encoded"?kt(I,e,E):E})}const Ft=e=>{var t;if(!e||typeof e!="object")throw new Error("Invalid options parameter. It requires an object.");if(!e.password)throw new Error("Password must be specified");if(e.password=Y(e.password),e.password.length<1)throw new Error("Password must be specified");if(!e.salt)throw new Error("Salt must be specified");if(e.salt=Y(e.salt),e.salt.length<8)throw new Error("Salt should be at least 8 bytes long");if(e.secret=Y((t=e.secret)!==null&&t!==void 0?t:""),!Number.isInteger(e.iterations)||e.iterations<1)throw new Error("Iterations should be a positive number");if(!Number.isInteger(e.parallelism)||e.parallelism<1)throw new Error("Parallelism should be a positive number");if(!Number.isInteger(e.hashLength)||e.hashLength<4)throw new Error("Hash length should be at least 4 bytes.");if(!Number.isInteger(e.memorySize))throw new Error("Memory size should be specified.");if(e.memorySize<8*e.parallelism)throw new Error("Memory size should be at least 8 * parallelism.");if(e.outputType===void 0&&(e.outputType="hex"),!["hex","binary","encoded"].includes(e.outputType))throw new Error(`Insupported output type ${e.outputType}. Valid values: ['hex', 'binary', 'encoded']`)};function Ue(e){return x(this,void 0,void 0,function*(){return Ft(e),Dt(Object.assign(Object.assign({},e),{hashType:"id"}))})}new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;new D;const Ut=32;async function bt(e,t,A=pe){be(A);try{const i=await Ue({password:e,salt:t,iterations:A.tCost,memorySize:A.mCost,parallelism:A.pCost,hashLength:Ut,outputType:"binary"});return Ce(i)}catch{throw new Error("Key derivation failed")}}function be(e){if(e.mCost<16384)throw new Error("KDF memory cost too low (minimum 16 MiB)");if(e.mCost>1048576)throw new Error("KDF memory cost too high (maximum 1 GiB)");if(e.tCost<1)throw new Error("KDF time cost must be at least 1");if(e.tCost>10)throw new Error("KDF time cost too high (maximum 10)");if(e.pCost<1)throw new Error("KDF parallelism must be at least 1");if(e.pCost>4)throw new Error("KDF parallelism too high (maximum 4)")}async function mt(){try{const e=await Ue({password:"test",salt:new Uint8Array(16),iterations:1,memorySize:1024,parallelism:1,hashLength:32,outputType:"binary"});return e.length!==32?!1:(he(e),!0)}catch{return!1}}function Gt(e){return e==="localhost"||e==="127.0.0.1"||e.endsWith(".localhost")}function Kt(e){if(typeof window>"u")return;const t=window.location.hostname;if(!Gt(t))throw new Error("[Cedros] WebAuthn RP domain validation is not configured. Set wallet.allowedRpDomains to a non-empty list of allowed domains.")}function ue(){return typeof window<"u"&&typeof window.PublicKeyCredential<"u"&&typeof navigator.credentials<"u"}async function Ht(){if(!ue())return!1;try{if(!await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())return!1;if("getClientCapabilities"in PublicKeyCredential&&typeof PublicKeyCredential.getClientCapabilities=="function"){const t=await PublicKeyCredential.getClientCapabilities();if(t&&"prf"in t)return t.prf===!0}return!0}catch{return!1}}async function Jt(e,t){if(!ue())throw new Error("WebAuthn is not available in this browser");Kt();const A=ke(e),i=await navigator.credentials.get({publicKey:{challenge:crypto.getRandomValues(new Uint8Array(32)),rpId:window.location.hostname,allowCredentials:[],userVerification:"required",timeout:6e4,extensions:{prf:{eval:{first:A}}}}});if(!i)throw new Error("Passkey authentication was cancelled");const n=i.getClientExtensionResults().prf?.results?.first;if(!n)throw new Error("PRF extension did not return a result during authentication");const I=new Uint8Array(n);if(I.length!==32)throw new Error(`Unexpected PRF output length: expected 32 bytes, got ${I.length}. The authenticator may not be compatible.`);return{prfOutput:I}}async function Mt(){const[e,t,A,i,r,n,I]=await Promise.all([Vt(),Nt(),It(),Pt(),Promise.resolve(ue()),Ht(),mt()]);return{webCrypto:e,aesGcm:t,hkdf:A,ed25519:i,webAuthn:r,webAuthnPrf:n,argon2:I,allSupported:e&&t&&A&&r&&n&&I}}async function Vt(){try{return typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof crypto.getRandomValues=="function"}catch{return!1}}async function Nt(){try{const e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]),t=new Uint8Array([1,2,3,4]),A=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:A},e,t),r=await crypto.subtle.decrypt({name:"AES-GCM",iv:A},e,i),n=new Uint8Array(r);return n.length===t.length&&n.every((I,c)=>I===t[c])}catch{return!1}}async function Pt(){try{return await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"]),!0}catch{return!1}}function Yt(e){if(e.allSupported)return null;const t=[];return e.webCrypto||t.push("Web Crypto API"),e.aesGcm||t.push("AES-GCM encryption"),e.hkdf||t.push("HKDF key derivation"),e.webAuthn||t.push("WebAuthn/Passkeys"),e.webAuthnPrf||t.push("WebAuthn PRF extension (requires platform authenticator)"),e.argon2||t.push("Argon2 password hashing"),t.length===0?null:`Your browser or device is missing required features: ${t.join(", ")}. Please use a modern browser with a platform authenticator (e.g., Touch ID, Face ID, Windows Hello).`}function Ot(){const e=typeof navigator<"u"?navigator.userAgent:"",t=e.match(/Chrome\/(\d+)/);if(t){const n=parseInt(t[1],10);return{browser:"Chrome",version:t[1],likelySupported:n>=116}}const A=e.match(/Version\/(\d+)/);if(A&&e.includes("Safari")&&!e.includes("Chrome")){const n=parseInt(A[1],10);return{browser:"Safari",version:A[1],likelySupported:n>=17}}const i=e.match(/Firefox\/(\d+)/);if(i)return{browser:"Firefox",version:i[1],likelySupported:!1};const r=e.match(/Edg\/(\d+)/);if(r){const n=parseInt(r[1],10);return{browser:"Edge",version:r[1],likelySupported:n>=116}}return{browser:"Unknown",version:"Unknown",likelySupported:!1}}let $=null,se=null;const vt=6e4;async function xt(e=!1){const t=Date.now(),A=se===null||t-se>vt;return!e&&!(typeof window>"u")&&!A&&$!==null||($=await Mt(),se=Date.now()),$}function me(e){switch(e.type){case"password":return{password:e.password};case"prfOutput":return{prfOutput:e.prfOutput}}}function Ge(){const e=F.useCedrosLoginOptional(),[t,A]=o.useState(!1),[i,r]=o.useState(null),n=e?.config.serverUrl,I=e?.config.requestTimeout,c=e?.config.retryAttempts,u=e?._internal?.getAccessToken,s=o.useMemo(()=>e?new F.ApiClient({baseUrl:n,timeoutMs:I,retryAttempts:c,getAccessToken:u}):null,[e,n,I,c,u]),p=o.useCallback(async()=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.get("/wallet/status")}catch(a){const l=F.handleApiError(a,"Failed to fetch wallet status");throw r(l.message),l}finally{A(!1)}},[s]),y=o.useCallback(async()=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.get("/wallet/material")}catch(a){const l=F.handleApiError(a,"Failed to fetch wallet material");if(l.code==="NOT_FOUND")return null;throw r(l.message),l}finally{A(!1)}},[s]),B=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{await s.post("/wallet/enroll",a)}catch(l){const Q=F.handleApiError(l,"Failed to enroll wallet");throw r(Q.message),Q}finally{A(!1)}},[s]),b=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{await s.post("/wallet/recover",a)}catch(l){const Q=F.handleApiError(l,"Failed to recover wallet");throw r(Q.message),Q}finally{A(!1)}},[s]),U=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.post("/wallet/sign",a)}catch(l){const Q=F.handleApiError(l,"Failed to sign transaction");throw r(Q.message),Q}finally{A(!1)}},[s]),C=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{await s.post("/wallet/rotate-user-secret",a)}catch(l){const Q=F.handleApiError(l,"Failed to rotate user secret");throw r(Q.message),Q}finally{A(!1)}},[s]),d=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.post("/wallet/unlock",me(a))}catch(l){const Q=F.handleApiError(l,"Failed to unlock wallet");throw r(Q.message),Q}finally{A(!1)}},[s]),w=o.useCallback(async()=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{await s.post("/wallet/lock",{})}catch(a){const l=F.handleApiError(a,"Failed to lock wallet");throw r(l.message),l}finally{A(!1)}},[s]),m=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.post("/wallet/share-b",a)}catch(l){const Q=F.handleApiError(l,"Failed to get Share B for recovery");throw r(Q.message),Q}finally{A(!1)}},[s]),k=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.post("/wallet/derived",a)}catch(l){const Q=F.handleApiError(l,"Failed to create derived wallet");throw r(Q.message),Q}finally{A(!1)}},[s]),E=o.useCallback(async()=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{return await s.get("/wallet/derived")}catch(a){const l=F.handleApiError(a,"Failed to list wallets");throw r(l.message),l}finally{A(!1)}},[s]),h=o.useCallback(async a=>{if(!s)throw new Error("useWalletMaterial must be used within a CedrosLoginProvider");A(!0),r(null);try{await s.delete(`/wallet/derived/${a}`)}catch(l){const Q=F.handleApiError(l,"Failed to delete derived wallet");throw r(Q.message),Q}finally{A(!1)}},[s]),g=o.useCallback(()=>r(null),[]);return{getStatus:p,getMaterial:y,enroll:B,recover:b,signTransaction:U,rotateUserSecret:C,unlock:d,lock:w,getShareBForRecovery:m,createDerivedWallet:k,listAllWallets:E,deleteDerivedWallet:h,isLoading:t,error:i,clearError:g}}const Rt={status:"not_enrolled",solanaPubkey:null,authMethod:null,hasExternalWallet:!1,isUnlocked:!1,capabilities:null,isSupported:!1,error:null,refresh:async()=>{},clearError:()=>{}};function Ke(){const t=F.useCedrosLoginOptional()!==null,[A,i]=o.useState("loading"),[r,n]=o.useState(null),[I,c]=o.useState(null),[u,s]=o.useState(!1),[p,y]=o.useState(!1),[B,b]=o.useState(null),[U,C]=o.useState(null),{getStatus:d,isLoading:w}=Ge(),m=o.useRef(!1);o.useEffect(()=>{if(!t)return;let h=!1;return(async()=>{try{const a=await xt();if(h)return;b(a),a.allSupported||(i("error"),C("Your browser or device does not support all required features. Please use a modern browser with a platform authenticator."))}catch{if(h)return;b(null),i("error"),C("Failed to check crypto capabilities")}})(),()=>{h=!0}},[t]);const k=o.useCallback(async()=>{if(!(!t||!B?.allSupported)){i("loading"),C(null);try{const h=await d();n(h.solanaPubkey??null),c(h.authMethod??null),s(h.hasExternalWallet),y(h.unlocked),h.hasExternalWallet?i("enrolled_unlocked"):h.enrolled?i(h.unlocked?"enrolled_unlocked":"enrolled_locked"):i("not_enrolled")}catch(h){i("error"),C(h instanceof Error?h.message:"Failed to fetch wallet status")}}},[t,B?.allSupported,d]);o.useEffect(()=>{t&&B?.allSupported&&!w&&!m.current&&(m.current=!0,k())},[t,B?.allSupported,w,k]);const E=o.useCallback(()=>C(null),[]);return t?{status:A,solanaPubkey:r,authMethod:I,hasExternalWallet:u,isUnlocked:p,capabilities:B,isSupported:B?.allSupported??!1,error:U,refresh:k,clearError:E}:Rt}const ee="__CEDROS_EMBEDDED_WALLET__";function Tt(e){typeof window<"u"&&(window[ee]=e)}function Ie(){typeof window<"u"&&delete window[ee]}function Lt(){return typeof window>"u"?!1:window[ee]?.available??!1}function Xt(){return typeof window>"u"?null:window[ee]??null}function Wt(){const{config:e,user:t}=F.useCedrosLogin(),{status:A,solanaPubkey:i,hasExternalWallet:r}=Ke(),n=e.wallet?.exposeAvailability??!1,I=e.wallet?.exposePublicKey??!1;return o.useEffect(()=>{if(!n||!t){Ie();return}if(r){Ie();return}if(A==="loading")return;const c=A==="enrolled_locked"||A==="enrolled_unlocked";return Tt({available:c,publicKey:I&&c?i:null}),()=>{Ie()}},[n,I,t,A,i,r]),null}function jt({config:e,children:t}){const[A,i]=o.useState(null),[r,n]=o.useState(!1),I=o.useRef(e.callbacks);I.current=e.callbacks;const c=o.useRef({onLoginSuccess:(...N)=>I.current?.onLoginSuccess?.(...N),onLoginError:(...N)=>I.current?.onLoginError?.(...N),onLogout:()=>I.current?.onLogout?.(),onSessionExpired:()=>I.current?.onSessionExpired?.()}),u=o.useRef(null);o.useEffect(()=>{if(typeof window>"u")return;const N=new URLSearchParams(window.location.search),v=N.get("ref")||N.get("referral");v&&(u.current=v)},[]);const s=e.features==="auto",{features:p,googleClientId:y,appleClientId:B,socialButtonOrder:b,isLoading:U}=Je(e.serverUrl,s,e.requestTimeout),C=o.useMemo(()=>!s||!p?e:{...e,features:p,googleClientId:e.googleClientId??y,appleClientId:e.appleClientId??B},[e,s,p,y,B]),d=o.useMemo(()=>JSON.stringify(C.themeOverrides??null),[C.themeOverrides]),w=o.useMemo(()=>JSON.stringify(C.session??null),[C.session]),m=o.useMemo(()=>JSON.stringify(C.features??null),[C.features]),k=o.useMemo(()=>JSON.stringify(C.forms??null),[C.forms]),E=o.useMemo(()=>C,[C.serverUrl,C.googleClientId,C.appleClientId,C.requestTimeout,C.retryAttempts,C.theme,d,w,m,k]),h=E.unstyled??!1,g=Ee({theme:h?void 0:E.theme,themeOverrides:h?void 0:E.themeOverrides}),{user:a,authState:l,handleLoginSuccess:Q,logout:f,refreshUser:S,getAccessToken:G}=ve({serverUrl:E.serverUrl,session:E.session,callbacks:c.current,requestTimeoutMs:E.requestTimeout}),H=o.useCallback(async()=>{i(null),await f()},[f]),K=o.useCallback((...N)=>{i(null),Q(...N)},[Q]),J=o.useCallback(()=>n(!0),[]),M=o.useCallback(()=>n(!1),[]),j=o.useMemo(()=>({config:E,user:a,authState:l,logout:H,refreshUser:S,socialButtonOrder:s?b:void 0,_internal:{handleLoginSuccess:K,getAccessToken:G,getReferralCode:()=>u.current}}),[E,a,l,H,S,s,b,K,G]),O=o.useMemo(()=>({error:A,isModalOpen:r,openModal:J,closeModal:M}),[A,r,J,M]),T=o.useMemo(()=>({...j,...O}),[j,O]);return s&&U?null:L.jsx(Ae.AuthStateContext.Provider,{value:j,children:L.jsx(Ae.AuthUIContext.Provider,{value:O,children:L.jsx(Ae.CedrosLoginContext.Provider,{value:T,children:L.jsxs("div",{className:g.className,style:g.style,children:[L.jsx(Wt,{}),t]})})})})}function Zt(){const{user:e,authState:t,error:A,logout:i,refreshUser:r,openModal:n,closeModal:I}=F.useCedrosLogin();return{user:e,authState:t,error:A,isAuthenticated:t==="authenticated"&&e!==null,isLoading:t==="loading",logout:i,refreshUser:r,openLoginModal:n,closeLoginModal:I}}exports.CedrosLoginProvider=jt;exports.DEFAULT_KDF_PARAMS=pe;exports.aesGcmEncryptToBase64=nt;exports.argon2Derive=bt;exports.authenticateWithDiscoverablePrf=Jt;exports.base64ToUint8Array=ke;exports.deriveKeyFromPrf=st;exports.generateArgon2Salt=et;exports.generatePrfSalt=tt;exports.generateSeed=$e;exports.getBrowserSupportInfo=Ot;exports.getEmbeddedWalletInfo=Xt;exports.getMissingCapabilitiesMessage=Yt;exports.isEmbeddedWalletAvailable=Lt;exports.toCredentialRequest=me;exports.toEncryptionKey=Ce;exports.toSeed=ye;exports.toShamirShare=je;exports.uint8ArrayToBase64=ae;exports.useAuth=Zt;exports.useThemeManager=Ee;exports.useWallet=Ke;exports.useWalletMaterial=Ge;exports.validateKdfParams=be;exports.wipeAll=At;exports.wipeBytes=he;