@cedros/login-react 0.0.14 → 0.0.15

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 (70) hide show
  1. package/dist/{AuthenticationSettings-D739nNul.cjs → AuthenticationSettings-CjGGqbcS.cjs} +1 -1
  2. package/dist/{AuthenticationSettings-D739nNul.cjs.map → AuthenticationSettings-CjGGqbcS.cjs.map} +1 -1
  3. package/dist/{AuthenticationSettings-Dx3JCI3m.js → AuthenticationSettings-DGWktSVw.js} +1 -1
  4. package/dist/{AuthenticationSettings-Dx3JCI3m.js.map → AuthenticationSettings-DGWktSVw.js.map} +1 -1
  5. package/dist/{AuthenticationSettings-vowmQPXz.js → AuthenticationSettings-Dg6ATgOl.js} +2 -2
  6. package/dist/{AuthenticationSettings-vowmQPXz.js.map → AuthenticationSettings-Dg6ATgOl.js.map} +1 -1
  7. package/dist/{AuthenticationSettings-DtLoxQ2z.cjs → AuthenticationSettings-HhrUAmM6.cjs} +1 -1
  8. package/dist/{AuthenticationSettings-DtLoxQ2z.cjs.map → AuthenticationSettings-HhrUAmM6.cjs.map} +1 -1
  9. package/dist/AutosaveStatus-BDWxAg4U.cjs +1 -0
  10. package/dist/AutosaveStatus-BDWxAg4U.cjs.map +1 -0
  11. package/dist/{AutosaveStatus-Ciyt350A.js → AutosaveStatus-DeViUyyI.js} +0 -6
  12. package/dist/AutosaveStatus-DeViUyyI.js.map +1 -0
  13. package/dist/{CreditSystemSettings-C6dUsu72.cjs → CreditSystemSettings-BykhytcS.cjs} +1 -1
  14. package/dist/{CreditSystemSettings-C6dUsu72.cjs.map → CreditSystemSettings-BykhytcS.cjs.map} +1 -1
  15. package/dist/{CreditSystemSettings-bVuNLsqp.js → CreditSystemSettings-CSlsQynZ.js} +1 -1
  16. package/dist/{CreditSystemSettings-bVuNLsqp.js.map → CreditSystemSettings-CSlsQynZ.js.map} +1 -1
  17. package/dist/{CreditSystemSettings-CBot8EPW.cjs → CreditSystemSettings-CyFQbXMh.cjs} +1 -1
  18. package/dist/{CreditSystemSettings-CBot8EPW.cjs.map → CreditSystemSettings-CyFQbXMh.cjs.map} +1 -1
  19. package/dist/{CreditSystemSettings-BQ3h4CyM.js → CreditSystemSettings-DBr7QS59.js} +1 -1
  20. package/dist/{CreditSystemSettings-BQ3h4CyM.js.map → CreditSystemSettings-DBr7QS59.js.map} +1 -1
  21. package/dist/{EmailSettings-B9qwPSiM.cjs → EmailSettings-Bup2rCgU.cjs} +1 -1
  22. package/dist/{EmailSettings-B9qwPSiM.cjs.map → EmailSettings-Bup2rCgU.cjs.map} +1 -1
  23. package/dist/{EmailSettings-mxlKNcPl.js → EmailSettings-C04qdJCz.js} +1 -1
  24. package/dist/{EmailSettings-mxlKNcPl.js.map → EmailSettings-C04qdJCz.js.map} +1 -1
  25. package/dist/{EmailSettings-RbgAq9FB.cjs → EmailSettings-C0Ss6Cne.cjs} +1 -1
  26. package/dist/{EmailSettings-RbgAq9FB.cjs.map → EmailSettings-C0Ss6Cne.cjs.map} +1 -1
  27. package/dist/{EmailSettings-CCA8dNCi.js → EmailSettings-DAqH_xum.js} +1 -1
  28. package/dist/{EmailSettings-CCA8dNCi.js.map → EmailSettings-DAqH_xum.js.map} +1 -1
  29. package/dist/{EmbeddedWalletSettings-B4h-8rxB.cjs → EmbeddedWalletSettings-B0XkNuPR.cjs} +1 -1
  30. package/dist/{EmbeddedWalletSettings-B4h-8rxB.cjs.map → EmbeddedWalletSettings-B0XkNuPR.cjs.map} +1 -1
  31. package/dist/{EmbeddedWalletSettings-CXlZFFDw.js → EmbeddedWalletSettings-DDFQhQOw.js} +1 -1
  32. package/dist/{EmbeddedWalletSettings-CXlZFFDw.js.map → EmbeddedWalletSettings-DDFQhQOw.js.map} +1 -1
  33. package/dist/{EmbeddedWalletSettings-BInZvFZf.js → EmbeddedWalletSettings-DYh884HP.js} +1 -1
  34. package/dist/{EmbeddedWalletSettings-BInZvFZf.js.map → EmbeddedWalletSettings-DYh884HP.js.map} +1 -1
  35. package/dist/{EmbeddedWalletSettings-D5JXae1L.cjs → EmbeddedWalletSettings-YX0Dk_b_.cjs} +1 -1
  36. package/dist/{EmbeddedWalletSettings-D5JXae1L.cjs.map → EmbeddedWalletSettings-YX0Dk_b_.cjs.map} +1 -1
  37. package/dist/{ServerSettings-CYTlQ2xy.cjs → ServerSettings-CInJe4jY.cjs} +1 -1
  38. package/dist/{ServerSettings-CYTlQ2xy.cjs.map → ServerSettings-CInJe4jY.cjs.map} +1 -1
  39. package/dist/{ServerSettings-DFs9jQ3f.cjs → ServerSettings-CwnEI-PC.cjs} +1 -1
  40. package/dist/{ServerSettings-DFs9jQ3f.cjs.map → ServerSettings-CwnEI-PC.cjs.map} +1 -1
  41. package/dist/{ServerSettings-pSmWDC1d.js → ServerSettings-DVEtfDQo.js} +1 -1
  42. package/dist/{ServerSettings-pSmWDC1d.js.map → ServerSettings-DVEtfDQo.js.map} +1 -1
  43. package/dist/{ServerSettings-BE8fsE5k.js → ServerSettings-DakhpYcO.js} +1 -1
  44. package/dist/{ServerSettings-BE8fsE5k.js.map → ServerSettings-DakhpYcO.js.map} +1 -1
  45. package/dist/{SettingsPageLayout-j5lMjEID.cjs → SettingsPageLayout-C6DWgyXS.cjs} +1 -1
  46. package/dist/{SettingsPageLayout-j5lMjEID.cjs.map → SettingsPageLayout-C6DWgyXS.cjs.map} +1 -1
  47. package/dist/{SettingsPageLayout--GZ_iHLc.js → SettingsPageLayout-CLJI6hFQ.js} +1 -1
  48. package/dist/{SettingsPageLayout--GZ_iHLc.js.map → SettingsPageLayout-CLJI6hFQ.js.map} +1 -1
  49. package/dist/{WebhookSettings-CGyDKjrm.cjs → WebhookSettings-BMeykdRP.cjs} +1 -1
  50. package/dist/{WebhookSettings-CGyDKjrm.cjs.map → WebhookSettings-BMeykdRP.cjs.map} +1 -1
  51. package/dist/{WebhookSettings-C-gvNAW1.cjs → WebhookSettings-BNVooF0B.cjs} +1 -1
  52. package/dist/{WebhookSettings-C-gvNAW1.cjs.map → WebhookSettings-BNVooF0B.cjs.map} +1 -1
  53. package/dist/{WebhookSettings-kIstSjZi.js → WebhookSettings-DXeDYhAe.js} +1 -1
  54. package/dist/{WebhookSettings-kIstSjZi.js.map → WebhookSettings-DXeDYhAe.js.map} +1 -1
  55. package/dist/{WebhookSettings-Bb70MbFj.js → WebhookSettings-DdbxNPZ9.js} +1 -1
  56. package/dist/{WebhookSettings-Bb70MbFj.js.map → WebhookSettings-DdbxNPZ9.js.map} +1 -1
  57. package/dist/admin-only.cjs +1 -1
  58. package/dist/admin-only.js +1 -1
  59. package/dist/index.cjs +8 -8
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.js +10 -16
  62. package/dist/index.js.map +1 -1
  63. package/dist/{plugin-D1NdppqC.js → plugin-CW_ycXye.js} +1 -1
  64. package/dist/{plugin-D1NdppqC.js.map → plugin-CW_ycXye.js.map} +1 -1
  65. package/dist/{plugin-8_dpq7tC.cjs → plugin-CnbFRy5o.cjs} +1 -1
  66. package/dist/{plugin-8_dpq7tC.cjs.map → plugin-CnbFRy5o.cjs.map} +1 -1
  67. package/package.json +1 -1
  68. package/dist/AutosaveStatus-CCrZszKA.cjs +0 -1
  69. package/dist/AutosaveStatus-CCrZszKA.cjs.map +0 -1
  70. package/dist/AutosaveStatus-Ciyt350A.js.map +0 -1
@@ -445,7 +445,7 @@ const l = {
445
445
  /* @__PURE__ */ e("line", { x1: "6", x2: "6.01", y1: "6", y2: "6" }),
446
446
  /* @__PURE__ */ e("line", { x1: "6", x2: "6.01", y1: "18", y2: "18" })
447
447
  ] })
448
- }, ee = w(() => import("./UsersSection-t-zm0jZW.js")), re = w(() => import("./TeamSection-BIECkp7g.js")), se = w(() => import("./DepositsSection-DD9MKUFt.js")), ie = w(() => import("./WithdrawalsSection-yRDTVFsb.js")), ne = w(() => import("./AuthenticationSettings-Dx3JCI3m.js")), oe = w(() => import("./EmbeddedWalletSettings-CXlZFFDw.js")), ae = w(() => import("./EmailSettings-mxlKNcPl.js")), te = w(() => import("./WebhookSettings-Bb70MbFj.js")), le = w(() => import("./CreditSystemSettings-bVuNLsqp.js")), de = w(() => import("./ServerSettings-pSmWDC1d.js")), ce = {
448
+ }, ee = w(() => import("./UsersSection-t-zm0jZW.js")), re = w(() => import("./TeamSection-BIECkp7g.js")), se = w(() => import("./DepositsSection-DD9MKUFt.js")), ie = w(() => import("./WithdrawalsSection-yRDTVFsb.js")), ne = w(() => import("./AuthenticationSettings-DGWktSVw.js")), oe = w(() => import("./EmbeddedWalletSettings-DDFQhQOw.js")), ae = w(() => import("./EmailSettings-C04qdJCz.js")), te = w(() => import("./WebhookSettings-DdbxNPZ9.js")), le = w(() => import("./CreditSystemSettings-CSlsQynZ.js")), de = w(() => import("./ServerSettings-DVEtfDQo.js")), ce = {
449
449
  "login:users:read": ["admin", "owner"],
450
450
  "login:users:write": ["admin", "owner"],
451
451
  "login:members:read": ["member:read", "admin", "owner"],
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-D1NdppqC.js","sources":["../src/components/admin/ProfileDropdown.tsx","../src/admin/AdminShell.tsx","../src/admin/icons.tsx","../src/admin/plugin.tsx"],"sourcesContent":["/**\n * Profile Dropdown Component\n *\n * Displays user avatar/name with a dropdown menu for settings and logout.\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\n\nexport interface ProfileDropdownProps {\n /** User's display name */\n name?: string;\n /** User's email */\n email?: string;\n /** User's profile picture URL */\n picture?: string;\n /** Callback when Settings is clicked */\n onSettings?: () => void;\n /** Callback when Logout is clicked */\n onLogout?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n/**\n * Profile dropdown button with settings and logout options.\n *\n * @example\n * ```tsx\n * <ProfileDropdown\n * name={user.name}\n * email={user.email}\n * picture={user.picture}\n * onSettings={() => navigate('/settings')}\n * onLogout={logout}\n * />\n * ```\n */\nexport function ProfileDropdown({\n name,\n email,\n picture,\n onSettings,\n onLogout,\n className = '',\n}: ProfileDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }\n }, [isOpen]);\n\n // Close dropdown on escape key\n useEffect(() => {\n function handleEscape(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const handleSettings = useCallback(() => {\n setIsOpen(false);\n onSettings?.();\n }, [onSettings]);\n\n const handleLogout = useCallback(() => {\n setIsOpen(false);\n onLogout?.();\n }, [onLogout]);\n\n const displayName = name || 'User';\n const initial = (name?.[0] || email?.[0] || '?').toUpperCase();\n\n return (\n <div className={`cedros-profile-dropdown ${className}`} ref={dropdownRef}>\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__trigger\"\n onClick={() => setIsOpen(!isOpen)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n >\n <div className=\"cedros-profile-dropdown__avatar\">\n {picture ? (\n <img\n src={picture}\n alt={displayName}\n className=\"cedros-profile-dropdown__avatar-img\"\n referrerPolicy=\"no-referrer\"\n />\n ) : (\n <span className=\"cedros-profile-dropdown__avatar-placeholder\">{initial}</span>\n )}\n </div>\n <div className=\"cedros-profile-dropdown__info\">\n <span className=\"cedros-profile-dropdown__name\">{displayName}</span>\n {email && <span className=\"cedros-profile-dropdown__email\">{email}</span>}\n </div>\n <svg\n className={`cedros-profile-dropdown__chevron ${isOpen ? 'cedros-profile-dropdown__chevron--open' : ''}`}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"cedros-profile-dropdown__menu\" role=\"menu\">\n {onSettings && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item\"\n onClick={handleSettings}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n Settings\n </button>\n )}\n {onLogout && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger\"\n onClick={handleLogout}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n Log out\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n","/**\n * AdminShell - Unified Admin Dashboard Host\n *\n * A shell component that hosts admin plugins from cedros-login, cedros-pay,\n * or any compatible plugin. Provides unified sidebar navigation and content area.\n *\n * @example\n * ```tsx\n * import { AdminShell } from '@cedros/login-react';\n * import { cedrosLoginPlugin } from '@cedros/login-react';\n * import { cedrosPayPlugin } from '@cedros/pay-react';\n *\n * function AdminPage() {\n * const hostContext = useBuildHostContext();\n * return (\n * <AdminShell\n * plugins={[cedrosLoginPlugin, cedrosPayPlugin]}\n * hostContext={hostContext}\n * />\n * );\n * }\n * ```\n */\n\nimport React, {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n Suspense,\n type ReactNode,\n} from 'react';\nimport type {\n AdminPlugin,\n PluginRegistry,\n HostContext,\n QualifiedSectionId,\n PluginContext,\n ResolvedSection,\n} from './types';\nimport { LoadingSpinner } from '../components/shared/LoadingSpinner';\nimport { ProfileDropdown } from '../components/admin/ProfileDropdown';\nimport { CedrosLoginContext, type CedrosLoginContextValue } from '../context/CedrosLoginContext';\nimport type { AuthUser } from '../types';\n\n// ============================================================================\n// Plugin Registry Implementation\n// ============================================================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private plugins = new Map<string, AdminPlugin>();\n private listeners = new Set<(plugins: AdminPlugin[]) => void>();\n\n register(plugin: AdminPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`Plugin ${plugin.id} already registered, replacing...`);\n }\n this.plugins.set(plugin.id, plugin);\n plugin.onRegister?.(this);\n this.notify();\n }\n\n unregister(pluginId: string): void {\n const plugin = this.plugins.get(pluginId);\n if (plugin) {\n plugin.onUnregister?.();\n this.plugins.delete(pluginId);\n this.notify();\n }\n }\n\n get(pluginId: string): AdminPlugin | undefined {\n return this.plugins.get(pluginId);\n }\n\n getAll(): AdminPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n subscribe(listener: (plugins: AdminPlugin[]) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(): void {\n const plugins = this.getAll();\n this.listeners.forEach((listener) => listener(plugins));\n }\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\ninterface AdminShellContextValue {\n registry: PluginRegistry;\n hostContext: HostContext;\n activeSection: QualifiedSectionId | null;\n setActiveSection: (section: QualifiedSectionId) => void;\n getPluginContext: (pluginId: string) => PluginContext | null;\n}\n\nconst AdminShellContext = createContext<AdminShellContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useAdminShell(): AdminShellContextValue {\n const ctx = useContext(AdminShellContext);\n if (!ctx) throw new Error('useAdminShell must be used within AdminShell');\n return ctx;\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface AdminShellProps {\n /** Dashboard title */\n title?: string;\n /** Plugins to load */\n plugins?: AdminPlugin[];\n /** Host context from parent providers */\n hostContext: HostContext;\n /** Default active section (qualified ID) */\n defaultSection?: QualifiedSectionId;\n /** Page size for lists */\n pageSize?: number;\n /** Refresh interval in ms (0 to disable) */\n refreshInterval?: number;\n /** Callback when section changes */\n onSectionChange?: (section: QualifiedSectionId) => void;\n /** Custom logo/header content */\n logo?: ReactNode;\n /** Additional sidebar footer content */\n sidebarFooter?: ReactNode;\n /** Callback when user clicks Settings in profile dropdown */\n onSettingsClick?: () => void;\n /** Callback when user clicks Logout in profile dropdown */\n onLogoutClick?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n// ============================================================================\n// Group Order Helpers\n// ============================================================================\n\n/** Build a group-label → order map from all registered plugins' groups[] config. */\nfunction buildGroupOrder(plugins: AdminPlugin[]): Map<string, number> {\n const order = new Map<string, number>();\n for (const plugin of plugins) {\n for (const group of plugin.groups ?? []) {\n // Key by label (sections reference groups by display name via section.group).\n // First plugin to declare a group wins; later plugins don't override.\n if (!order.has(group.label)) {\n order.set(group.label, group.order);\n }\n }\n }\n return order;\n}\n\n// ============================================================================\n// AdminShell Component\n// ============================================================================\n\nexport function AdminShell({\n title = 'Admin',\n plugins: initialPlugins = [],\n hostContext,\n defaultSection,\n pageSize = 20,\n refreshInterval = 0,\n onSectionChange,\n logo,\n sidebarFooter,\n onSettingsClick,\n onLogoutClick,\n className = '',\n}: AdminShellProps): React.JSX.Element {\n // Plugin registry\n const [registry] = useState(() => {\n const reg = new PluginRegistryImpl();\n initialPlugins.forEach((p) => reg.register(p));\n return reg;\n });\n\n // Track registered plugins for re-renders\n const [registeredPlugins, setRegisteredPlugins] = useState<AdminPlugin[]>(() =>\n registry.getAll()\n );\n\n useEffect(() => {\n return registry.subscribe(setRegisteredPlugins);\n }, [registry]);\n\n // Aggregate sections from all plugins\n const allSections = useMemo(() => {\n return registeredPlugins.flatMap((plugin) =>\n plugin.sections\n .filter((section) => {\n // Check RBAC permissions (role-based)\n if (section.requiredPermission) {\n if (!plugin.checkPermission(section.requiredPermission, hostContext)) {\n return false;\n }\n }\n // Check dashboard section permissions (owner-configured per role)\n if (hostContext.dashboardPermissions) {\n if (!hostContext.dashboardPermissions.canAccess(section.id)) {\n return false;\n }\n }\n return true;\n })\n .map(\n (section): ResolvedSection => ({\n ...section,\n qualifiedId: `${plugin.id}:${section.id}` as QualifiedSectionId,\n pluginId: plugin.id,\n cssNamespace: plugin.cssNamespace,\n })\n )\n );\n }, [registeredPlugins, hostContext]);\n\n // Active section state\n const [activeSection, setActiveSectionInternal] = useState<QualifiedSectionId | null>(\n () => defaultSection ?? allSections[0]?.qualifiedId ?? null\n );\n\n // Collapsible groups state\n const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());\n\n const toggleGroup = useCallback((groupName: string) => {\n setCollapsedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(groupName)) {\n next.delete(groupName);\n } else {\n next.add(groupName);\n }\n return next;\n });\n }, []);\n\n // Update active section when sections change and current is invalid\n useEffect(() => {\n if (activeSection && !allSections.find((s) => s.qualifiedId === activeSection)) {\n setActiveSectionInternal(allSections[0]?.qualifiedId ?? null);\n }\n }, [allSections, activeSection]);\n\n const setActiveSection = useCallback(\n (section: QualifiedSectionId) => {\n setActiveSectionInternal(section);\n onSectionChange?.(section);\n },\n [onSectionChange]\n );\n\n // Plugin context factory\n const getPluginContext = useCallback(\n (pluginId: string): PluginContext | null => {\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n return plugin.createPluginContext(hostContext);\n },\n [registry, hostContext]\n );\n\n // Group sections by group name, sorted by plugin-defined group order\n const groupedSections = useMemo(() => {\n const groupOrder = buildGroupOrder(registeredPlugins);\n const groups = new Map<string, ResolvedSection[]>();\n\n allSections.forEach((section) => {\n const groupName = section.group ?? 'Menu';\n const existing = groups.get(groupName) ?? [];\n groups.set(groupName, [...existing, section]);\n });\n\n // Sort groups by plugin-defined order (undeclared groups sink to bottom)\n const sortedGroups = Array.from(groups.entries()).sort(([a], [b]) => {\n const orderA = groupOrder.get(a) ?? 99;\n const orderB = groupOrder.get(b) ?? 99;\n return orderA - orderB;\n });\n\n return sortedGroups;\n }, [allSections, registeredPlugins]);\n\n // Get current section's component\n const currentSection = useMemo(() => {\n if (!activeSection) return null;\n const [pluginId, sectionId] = activeSection.split(':') as [string, string];\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n const Component = plugin.components[sectionId];\n if (!Component) return null;\n const pluginContext = plugin.createPluginContext(hostContext);\n return { Component, pluginContext, plugin };\n }, [activeSection, registry, hostContext]);\n\n // Context value\n const contextValue = useMemo<AdminShellContextValue>(\n () => ({\n registry,\n hostContext,\n activeSection,\n setActiveSection,\n getPluginContext,\n }),\n [registry, hostContext, activeSection, setActiveSection, getPluginContext]\n );\n\n // Bridge hostContext.cedrosLogin into CedrosLoginContext so hooks\n // (useOrgs, useAdminDeposits, etc.) work inside AdminShell sections.\n const cedrosLoginContextValue = useMemo<CedrosLoginContextValue | null>(() => {\n const cl = hostContext.cedrosLogin;\n if (!cl) return null;\n const user: AuthUser | null = cl.user\n ? { authMethods: [], emailVerified: false, createdAt: '', updatedAt: '', ...cl.user }\n : null;\n return {\n config: { serverUrl: cl.serverUrl },\n user,\n authState: cl.user ? 'authenticated' : 'unauthenticated',\n error: null,\n logout: async () => {},\n refreshUser: async () => {},\n isModalOpen: false,\n openModal: () => {},\n closeModal: () => {},\n _internal: {\n handleLoginSuccess: () => {},\n getAccessToken: cl.getAccessToken,\n },\n };\n }, [hostContext.cedrosLogin]);\n\n return (\n <AdminShellContext.Provider value={contextValue}>\n <CedrosLoginContext.Provider value={cedrosLoginContextValue}>\n <div className={`cedros-admin cedros-admin-shell ${className || ''}`}>\n {/* Sidebar */}\n <aside className=\"cedros-admin-shell__sidebar\">\n <div className=\"cedros-admin-shell__sidebar-header\">\n {logo ?? (\n <div className=\"cedros-admin-shell__logo\">\n <span className=\"cedros-admin-shell__logo-text\">{title}</span>\n </div>\n )}\n </div>\n\n <nav className=\"cedros-admin-shell__nav\">\n {groupedSections.map(([groupName, sections]) => {\n const isCollapsible = groupName === 'Configuration';\n const isCollapsed = collapsedGroups.has(groupName);\n\n return (\n <div key={groupName} className=\"cedros-admin-shell__nav-group\">\n {isCollapsible ? (\n <button\n type=\"button\"\n className=\"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible\"\n onClick={() => toggleGroup(groupName)}\n aria-expanded={!isCollapsed}\n >\n <span>{groupName}</span>\n <span\n className={`cedros-admin-shell__nav-chevron ${!isCollapsed ? 'cedros-admin-shell__nav-chevron--expanded' : ''}`}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </span>\n </button>\n ) : (\n <span className=\"cedros-admin-shell__nav-label\">{groupName}</span>\n )}\n {(!isCollapsible || !isCollapsed) &&\n sections\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n .map((section) => (\n <button\n key={section.qualifiedId}\n type=\"button\"\n className={`cedros-admin-shell__nav-item ${\n activeSection === section.qualifiedId\n ? 'cedros-admin-shell__nav-item--active'\n : ''\n }`}\n onClick={() => setActiveSection(section.qualifiedId)}\n aria-current={\n activeSection === section.qualifiedId ? 'page' : undefined\n }\n >\n <span className=\"cedros-admin-shell__nav-icon\">{section.icon}</span>\n <span className=\"cedros-admin-shell__nav-text\">{section.label}</span>\n {section.badge && (\n <span className=\"cedros-admin-shell__nav-badge\">{section.badge}</span>\n )}\n </button>\n ))}\n </div>\n );\n })}\n </nav>\n\n {/* User profile dropdown + optional custom footer */}\n {(hostContext.cedrosLogin?.user || sidebarFooter) && (\n <div className=\"cedros-admin-shell__sidebar-footer\">\n {hostContext.cedrosLogin?.user && (\n <ProfileDropdown\n name={hostContext.cedrosLogin.user.name}\n email={hostContext.cedrosLogin.user.email}\n picture={hostContext.cedrosLogin.user.picture}\n onSettings={onSettingsClick}\n onLogout={onLogoutClick}\n />\n )}\n {sidebarFooter}\n </div>\n )}\n </aside>\n\n {/* Main Content */}\n <main className=\"cedros-admin-shell__main\">\n {currentSection ? (\n <Suspense fallback={<LoadingFallback />}>\n <div\n className=\"cedros-admin-shell__section\"\n data-plugin-namespace={currentSection.plugin.cssNamespace}\n >\n <currentSection.Component\n pluginContext={currentSection.pluginContext}\n pageSize={pageSize}\n refreshInterval={refreshInterval}\n />\n </div>\n </Suspense>\n ) : (\n <div className=\"cedros-admin-shell__empty\">\n {allSections.length === 0\n ? 'No plugins loaded'\n : 'Select a section from the sidebar'}\n </div>\n )}\n </main>\n </div>\n </CedrosLoginContext.Provider>\n </AdminShellContext.Provider>\n );\n}\n\n// ============================================================================\n// Helper Components\n// ============================================================================\n\nfunction LoadingFallback(): React.JSX.Element {\n return (\n <div className=\"cedros-admin-shell__loading\">\n <LoadingSpinner />\n <span>Loading...</span>\n </div>\n );\n}\n","/**\n * Admin Dashboard Icons\n *\n * SVG icons for the admin dashboard sidebar and sections.\n * Lucide-style, 24x24 viewBox rendered at 16x16.\n */\n\nimport type { ReactNode } from 'react';\n\nconst iconProps = {\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n};\n\nexport const Icons: Record<string, ReactNode> = {\n users: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n members: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n invites: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n deposits: (\n <svg {...iconProps}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8\" />\n <path d=\"M12 18V6\" />\n </svg>\n ),\n\n withdrawals: (\n <svg {...iconProps}>\n <rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\" />\n <path d=\"M9 22v-4h6v4\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n </svg>\n ),\n\n settings: (\n <svg {...iconProps}>\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ),\n\n wallet: (\n <svg {...iconProps}>\n <path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" />\n </svg>\n ),\n\n chevronRight: (\n <svg {...iconProps}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n ),\n\n // Settings sub-page icons\n key: (\n <svg {...iconProps}>\n <path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\" />\n </svg>\n ),\n\n toggles: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"6\" />\n <circle cx=\"8\" cy=\"12\" r=\"2\" />\n </svg>\n ),\n\n shield: (\n <svg {...iconProps}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n ),\n\n mail: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n webhook: (\n <svg {...iconProps}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n ),\n\n coins: (\n <svg {...iconProps}>\n <circle cx=\"8\" cy=\"8\" r=\"6\" />\n <path d=\"M18.09 10.37A6 6 0 1 1 10.34 18\" />\n <path d=\"M7 6h1v4\" />\n <path d=\"m16.71 13.88.7.71-2.82 2.82\" />\n </svg>\n ),\n\n server: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n ),\n};\n","/**\n * Cedros Login Admin Plugin\n *\n * Exports the cedrosLoginPlugin for use with AdminShell.\n * Provides user management, deposits, withdrawals, and configuration sections.\n */\n\nimport { lazy } from 'react';\nimport type { AdminPlugin, HostContext, PluginContext, AdminSectionConfig } from './types';\nimport { Icons } from './icons';\n\n// ============================================================================\n// Lazy-loaded Section Components\n// ============================================================================\n\nconst UsersSection = lazy(() => import('./sections/UsersSection'));\nconst TeamSection = lazy(() => import('./sections/TeamSection'));\nconst DepositsSection = lazy(() => import('./sections/DepositsSection'));\nconst WithdrawalsSection = lazy(() => import('./sections/WithdrawalsSection'));\nconst AuthenticationSettings = lazy(() => import('./sections/AuthenticationSettings'));\nconst EmbeddedWalletSettings = lazy(() => import('./sections/EmbeddedWalletSettings'));\nconst EmailSettings = lazy(() => import('./sections/EmailSettings'));\nconst WebhookSettings = lazy(() => import('./sections/WebhookSettings'));\nconst CreditSystemSettings = lazy(() => import('./sections/CreditSystemSettings'));\nconst ServerSettings = lazy(() => import('./sections/ServerSettings'));\n\n// ============================================================================\n// Permission Mapping\n// ============================================================================\n\ntype LoginPermission =\n | 'login:users:read'\n | 'login:users:write'\n | 'login:members:read'\n | 'login:members:write'\n | 'login:invites:read'\n | 'login:invites:write'\n | 'login:deposits:read'\n | 'login:deposits:write'\n | 'login:settings:read'\n | 'login:settings:write';\n\n/**\n * Maps plugin permissions to org-level permissions/roles.\n */\nconst PERMISSION_MAP: Record<LoginPermission, string[]> = {\n 'login:users:read': ['admin', 'owner'],\n 'login:users:write': ['admin', 'owner'],\n 'login:members:read': ['member:read', 'admin', 'owner'],\n 'login:members:write': ['member:remove', 'member:role_change'],\n 'login:invites:read': ['invite:read', 'admin', 'owner'],\n 'login:invites:write': ['invite:create', 'invite:cancel'],\n 'login:deposits:read': ['admin', 'owner'],\n 'login:deposits:write': ['admin', 'owner'],\n 'login:settings:read': ['admin', 'owner'],\n 'login:settings:write': ['admin', 'owner'],\n};\n\n// ============================================================================\n// Section Configuration\n// ============================================================================\n\nconst SECTIONS: AdminSectionConfig[] = [\n // Users group (main sections)\n {\n id: 'users',\n label: 'Users',\n icon: Icons.users,\n group: 'Users',\n order: 0,\n requiredPermission: 'login:users:read',\n },\n {\n id: 'team',\n label: 'Team',\n icon: Icons.members,\n group: 'Users',\n order: 1,\n requiredPermission: 'login:members:read',\n },\n {\n id: 'deposits',\n label: 'Deposits',\n icon: Icons.deposits,\n group: 'Users',\n order: 2,\n requiredPermission: 'login:deposits:read',\n },\n {\n id: 'withdrawals',\n label: 'Withdrawals',\n icon: Icons.withdrawals,\n group: 'Users',\n order: 3,\n requiredPermission: 'login:deposits:read',\n },\n\n // Configuration group (settings sections)\n {\n id: 'settings-auth',\n label: 'Authentication',\n icon: Icons.key,\n group: 'Configuration',\n order: 0,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-email',\n label: 'Email & SMTP',\n icon: Icons.mail,\n group: 'Configuration',\n order: 1,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-webhooks',\n label: 'Webhooks',\n icon: Icons.webhook,\n group: 'Configuration',\n order: 2,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-wallet',\n label: 'User Wallets',\n icon: Icons.wallet,\n group: 'Configuration',\n order: 3,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-credits',\n label: 'Credit System',\n icon: Icons.coins,\n group: 'Configuration',\n order: 4,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-server',\n label: 'Auth Server',\n icon: Icons.server,\n group: 'Configuration',\n order: 5,\n requiredPermission: 'login:settings:read',\n },\n];\n\n// ============================================================================\n// Plugin Definition\n// ============================================================================\n\nexport const cedrosLoginPlugin: AdminPlugin = {\n id: 'cedros-login',\n name: 'Cedros Login',\n version: '1.0.0',\n\n sections: SECTIONS,\n\n groups: [\n { id: 'users', label: 'Users', order: 0 },\n { id: 'configuration', label: 'Configuration', order: 2 },\n ],\n\n components: {\n users: UsersSection,\n team: TeamSection,\n deposits: DepositsSection,\n withdrawals: WithdrawalsSection,\n 'settings-auth': AuthenticationSettings,\n 'settings-wallet': EmbeddedWalletSettings,\n 'settings-email': EmailSettings,\n 'settings-webhooks': WebhookSettings,\n 'settings-credits': CreditSystemSettings,\n 'settings-server': ServerSettings,\n },\n\n createPluginContext(hostContext: HostContext): PluginContext {\n const cedrosLogin = hostContext.cedrosLogin;\n if (!cedrosLogin) {\n throw new Error('cedros-login plugin requires cedrosLogin in hostContext');\n }\n\n return {\n serverUrl: cedrosLogin.serverUrl,\n userId: cedrosLogin.user?.id,\n getAccessToken: cedrosLogin.getAccessToken,\n hasPermission: (permission) => this.checkPermission(permission, hostContext),\n orgId: hostContext.org?.orgId,\n pluginData: {\n user: cedrosLogin.user,\n orgRole: hostContext.org?.role,\n },\n };\n },\n\n checkPermission(permission: string, hostContext: HostContext): boolean {\n const org = hostContext.org;\n\n // No org context = admin-level access (for global admins)\n if (!org) {\n // Check if user is in cedrosLogin context - assume admin if present\n return Boolean(hostContext.cedrosLogin?.user);\n }\n\n const requiredPerms = PERMISSION_MAP[permission as LoginPermission];\n if (!requiredPerms) {\n // Unknown permission - default deny\n return false;\n }\n\n // Check if user has any of the required permissions\n return requiredPerms.some(\n (p) =>\n org.permissions.includes(p) ||\n p === org.role ||\n (p === 'admin' && ['admin', 'owner'].includes(org.role)) ||\n (p === 'owner' && org.role === 'owner')\n );\n },\n\n cssNamespace: 'cedros-dashboard',\n};\n\n// Named export for convenience\nexport { cedrosLoginPlugin as loginPlugin };\n"],"names":["ProfileDropdown","name","email","picture","onSettings","onLogout","className","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","handleSettings","useCallback","handleLogout","displayName","initial","jsxs","jsx","PluginRegistryImpl","plugin","pluginId","listener","plugins","AdminShellContext","createContext","useAdminShell","ctx","useContext","buildGroupOrder","order","group","AdminShell","title","initialPlugins","hostContext","defaultSection","pageSize","refreshInterval","onSectionChange","logo","sidebarFooter","onSettingsClick","onLogoutClick","registry","reg","p","registeredPlugins","setRegisteredPlugins","allSections","useMemo","section","activeSection","setActiveSectionInternal","collapsedGroups","setCollapsedGroups","toggleGroup","groupName","prev","next","s","setActiveSection","getPluginContext","groupedSections","groupOrder","groups","existing","a","b","orderA","orderB","currentSection","sectionId","Component","pluginContext","contextValue","cedrosLoginContextValue","cl","user","CedrosLoginContext","sections","isCollapsible","isCollapsed","Suspense","LoadingFallback","LoadingSpinner","iconProps","Icons","UsersSection","lazy","TeamSection","DepositsSection","WithdrawalsSection","AuthenticationSettings","EmbeddedWalletSettings","EmailSettings","WebhookSettings","CreditSystemSettings","ServerSettings","PERMISSION_MAP","SECTIONS","cedrosLoginPlugin","cedrosLogin","permission","org","requiredPerms"],"mappings":";;;AAqCO,SAASA,EAAgB;AAAA,EAC9B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAyB;AACvB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAcC,EAAuB,IAAI;AAG/C,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,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EAAY;AAAA,MAC5B,eAAe,CAACC,MAAe,KAAK,gBAAgBA,GAAYpE,CAAW;AAAA,MAC3E,OAAOA,EAAY,KAAK;AAAA,MACxB,YAAY;AAAA,QACV,MAAMmE,EAAY;AAAA,QAClB,SAASnE,EAAY,KAAK;AAAA,MAAA;AAAA,IAC5B;AAAA,EAEJ;AAAA,EAEA,gBAAgBoE,GAAoBpE,GAAmC;AACrE,UAAMqE,IAAMrE,EAAY;AAGxB,QAAI,CAACqE;AAEH,aAAO,EAAQrE,EAAY,aAAa;AAG1C,UAAMsE,IAAgBN,GAAeI,CAA6B;AAClE,WAAKE,IAMEA,EAAc;AAAA,MACnB,CAAC3D,MACC0D,EAAI,YAAY,SAAS1D,CAAC,KAC1BA,MAAM0D,EAAI,QACT1D,MAAM,WAAW,CAAC,SAAS,OAAO,EAAE,SAAS0D,EAAI,IAAI,KACrD1D,MAAM,WAAW0D,EAAI,SAAS;AAAA,IAAA,IAT1B;AAAA,EAWX;AAAA,EAEA,cAAc;AAChB;"}
1
+ {"version":3,"file":"plugin-CW_ycXye.js","sources":["../src/components/admin/ProfileDropdown.tsx","../src/admin/AdminShell.tsx","../src/admin/icons.tsx","../src/admin/plugin.tsx"],"sourcesContent":["/**\n * Profile Dropdown Component\n *\n * Displays user avatar/name with a dropdown menu for settings and logout.\n */\n\nimport { useState, useRef, useEffect, useCallback } from 'react';\n\nexport interface ProfileDropdownProps {\n /** User's display name */\n name?: string;\n /** User's email */\n email?: string;\n /** User's profile picture URL */\n picture?: string;\n /** Callback when Settings is clicked */\n onSettings?: () => void;\n /** Callback when Logout is clicked */\n onLogout?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n/**\n * Profile dropdown button with settings and logout options.\n *\n * @example\n * ```tsx\n * <ProfileDropdown\n * name={user.name}\n * email={user.email}\n * picture={user.picture}\n * onSettings={() => navigate('/settings')}\n * onLogout={logout}\n * />\n * ```\n */\nexport function ProfileDropdown({\n name,\n email,\n picture,\n onSettings,\n onLogout,\n className = '',\n}: ProfileDropdownProps) {\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }\n }, [isOpen]);\n\n // Close dropdown on escape key\n useEffect(() => {\n function handleEscape(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n }\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const handleSettings = useCallback(() => {\n setIsOpen(false);\n onSettings?.();\n }, [onSettings]);\n\n const handleLogout = useCallback(() => {\n setIsOpen(false);\n onLogout?.();\n }, [onLogout]);\n\n const displayName = name || 'User';\n const initial = (name?.[0] || email?.[0] || '?').toUpperCase();\n\n return (\n <div className={`cedros-profile-dropdown ${className}`} ref={dropdownRef}>\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__trigger\"\n onClick={() => setIsOpen(!isOpen)}\n aria-expanded={isOpen}\n aria-haspopup=\"menu\"\n >\n <div className=\"cedros-profile-dropdown__avatar\">\n {picture ? (\n <img\n src={picture}\n alt={displayName}\n className=\"cedros-profile-dropdown__avatar-img\"\n referrerPolicy=\"no-referrer\"\n />\n ) : (\n <span className=\"cedros-profile-dropdown__avatar-placeholder\">{initial}</span>\n )}\n </div>\n <div className=\"cedros-profile-dropdown__info\">\n <span className=\"cedros-profile-dropdown__name\">{displayName}</span>\n {email && <span className=\"cedros-profile-dropdown__email\">{email}</span>}\n </div>\n <svg\n className={`cedros-profile-dropdown__chevron ${isOpen ? 'cedros-profile-dropdown__chevron--open' : ''}`}\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </button>\n\n {isOpen && (\n <div className=\"cedros-profile-dropdown__menu\" role=\"menu\">\n {onSettings && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item\"\n onClick={handleSettings}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n Settings\n </button>\n )}\n {onLogout && (\n <button\n type=\"button\"\n className=\"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger\"\n onClick={handleLogout}\n role=\"menuitem\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" />\n <polyline points=\"16 17 21 12 16 7\" />\n <line x1=\"21\" x2=\"9\" y1=\"12\" y2=\"12\" />\n </svg>\n Log out\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n","/**\n * AdminShell - Unified Admin Dashboard Host\n *\n * A shell component that hosts admin plugins from cedros-login, cedros-pay,\n * or any compatible plugin. Provides unified sidebar navigation and content area.\n *\n * @example\n * ```tsx\n * import { AdminShell } from '@cedros/login-react';\n * import { cedrosLoginPlugin } from '@cedros/login-react';\n * import { cedrosPayPlugin } from '@cedros/pay-react';\n *\n * function AdminPage() {\n * const hostContext = useBuildHostContext();\n * return (\n * <AdminShell\n * plugins={[cedrosLoginPlugin, cedrosPayPlugin]}\n * hostContext={hostContext}\n * />\n * );\n * }\n * ```\n */\n\nimport React, {\n createContext,\n useContext,\n useState,\n useCallback,\n useMemo,\n useEffect,\n Suspense,\n type ReactNode,\n} from 'react';\nimport type {\n AdminPlugin,\n PluginRegistry,\n HostContext,\n QualifiedSectionId,\n PluginContext,\n ResolvedSection,\n} from './types';\nimport { LoadingSpinner } from '../components/shared/LoadingSpinner';\nimport { ProfileDropdown } from '../components/admin/ProfileDropdown';\nimport { CedrosLoginContext, type CedrosLoginContextValue } from '../context/CedrosLoginContext';\nimport type { AuthUser } from '../types';\n\n// ============================================================================\n// Plugin Registry Implementation\n// ============================================================================\n\nclass PluginRegistryImpl implements PluginRegistry {\n private plugins = new Map<string, AdminPlugin>();\n private listeners = new Set<(plugins: AdminPlugin[]) => void>();\n\n register(plugin: AdminPlugin): void {\n if (this.plugins.has(plugin.id)) {\n console.warn(`Plugin ${plugin.id} already registered, replacing...`);\n }\n this.plugins.set(plugin.id, plugin);\n plugin.onRegister?.(this);\n this.notify();\n }\n\n unregister(pluginId: string): void {\n const plugin = this.plugins.get(pluginId);\n if (plugin) {\n plugin.onUnregister?.();\n this.plugins.delete(pluginId);\n this.notify();\n }\n }\n\n get(pluginId: string): AdminPlugin | undefined {\n return this.plugins.get(pluginId);\n }\n\n getAll(): AdminPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n subscribe(listener: (plugins: AdminPlugin[]) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(): void {\n const plugins = this.getAll();\n this.listeners.forEach((listener) => listener(plugins));\n }\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\ninterface AdminShellContextValue {\n registry: PluginRegistry;\n hostContext: HostContext;\n activeSection: QualifiedSectionId | null;\n setActiveSection: (section: QualifiedSectionId) => void;\n getPluginContext: (pluginId: string) => PluginContext | null;\n}\n\nconst AdminShellContext = createContext<AdminShellContextValue | null>(null);\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useAdminShell(): AdminShellContextValue {\n const ctx = useContext(AdminShellContext);\n if (!ctx) throw new Error('useAdminShell must be used within AdminShell');\n return ctx;\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface AdminShellProps {\n /** Dashboard title */\n title?: string;\n /** Plugins to load */\n plugins?: AdminPlugin[];\n /** Host context from parent providers */\n hostContext: HostContext;\n /** Default active section (qualified ID) */\n defaultSection?: QualifiedSectionId;\n /** Page size for lists */\n pageSize?: number;\n /** Refresh interval in ms (0 to disable) */\n refreshInterval?: number;\n /** Callback when section changes */\n onSectionChange?: (section: QualifiedSectionId) => void;\n /** Custom logo/header content */\n logo?: ReactNode;\n /** Additional sidebar footer content */\n sidebarFooter?: ReactNode;\n /** Callback when user clicks Settings in profile dropdown */\n onSettingsClick?: () => void;\n /** Callback when user clicks Logout in profile dropdown */\n onLogoutClick?: () => void;\n /** Additional CSS class */\n className?: string;\n}\n\n// ============================================================================\n// Group Order Helpers\n// ============================================================================\n\n/** Build a group-label → order map from all registered plugins' groups[] config. */\nfunction buildGroupOrder(plugins: AdminPlugin[]): Map<string, number> {\n const order = new Map<string, number>();\n for (const plugin of plugins) {\n for (const group of plugin.groups ?? []) {\n // Key by label (sections reference groups by display name via section.group).\n // First plugin to declare a group wins; later plugins don't override.\n if (!order.has(group.label)) {\n order.set(group.label, group.order);\n }\n }\n }\n return order;\n}\n\n// ============================================================================\n// AdminShell Component\n// ============================================================================\n\nexport function AdminShell({\n title = 'Admin',\n plugins: initialPlugins = [],\n hostContext,\n defaultSection,\n pageSize = 20,\n refreshInterval = 0,\n onSectionChange,\n logo,\n sidebarFooter,\n onSettingsClick,\n onLogoutClick,\n className = '',\n}: AdminShellProps): React.JSX.Element {\n // Plugin registry\n const [registry] = useState(() => {\n const reg = new PluginRegistryImpl();\n initialPlugins.forEach((p) => reg.register(p));\n return reg;\n });\n\n // Track registered plugins for re-renders\n const [registeredPlugins, setRegisteredPlugins] = useState<AdminPlugin[]>(() =>\n registry.getAll()\n );\n\n useEffect(() => {\n return registry.subscribe(setRegisteredPlugins);\n }, [registry]);\n\n // Aggregate sections from all plugins\n const allSections = useMemo(() => {\n return registeredPlugins.flatMap((plugin) =>\n plugin.sections\n .filter((section) => {\n // Check RBAC permissions (role-based)\n if (section.requiredPermission) {\n if (!plugin.checkPermission(section.requiredPermission, hostContext)) {\n return false;\n }\n }\n // Check dashboard section permissions (owner-configured per role)\n if (hostContext.dashboardPermissions) {\n if (!hostContext.dashboardPermissions.canAccess(section.id)) {\n return false;\n }\n }\n return true;\n })\n .map(\n (section): ResolvedSection => ({\n ...section,\n qualifiedId: `${plugin.id}:${section.id}` as QualifiedSectionId,\n pluginId: plugin.id,\n cssNamespace: plugin.cssNamespace,\n })\n )\n );\n }, [registeredPlugins, hostContext]);\n\n // Active section state\n const [activeSection, setActiveSectionInternal] = useState<QualifiedSectionId | null>(\n () => defaultSection ?? allSections[0]?.qualifiedId ?? null\n );\n\n // Collapsible groups state\n const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set());\n\n const toggleGroup = useCallback((groupName: string) => {\n setCollapsedGroups((prev) => {\n const next = new Set(prev);\n if (next.has(groupName)) {\n next.delete(groupName);\n } else {\n next.add(groupName);\n }\n return next;\n });\n }, []);\n\n // Update active section when sections change and current is invalid\n useEffect(() => {\n if (activeSection && !allSections.find((s) => s.qualifiedId === activeSection)) {\n setActiveSectionInternal(allSections[0]?.qualifiedId ?? null);\n }\n }, [allSections, activeSection]);\n\n const setActiveSection = useCallback(\n (section: QualifiedSectionId) => {\n setActiveSectionInternal(section);\n onSectionChange?.(section);\n },\n [onSectionChange]\n );\n\n // Plugin context factory\n const getPluginContext = useCallback(\n (pluginId: string): PluginContext | null => {\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n return plugin.createPluginContext(hostContext);\n },\n [registry, hostContext]\n );\n\n // Group sections by group name, sorted by plugin-defined group order\n const groupedSections = useMemo(() => {\n const groupOrder = buildGroupOrder(registeredPlugins);\n const groups = new Map<string, ResolvedSection[]>();\n\n allSections.forEach((section) => {\n const groupName = section.group ?? 'Menu';\n const existing = groups.get(groupName) ?? [];\n groups.set(groupName, [...existing, section]);\n });\n\n // Sort groups by plugin-defined order (undeclared groups sink to bottom)\n const sortedGroups = Array.from(groups.entries()).sort(([a], [b]) => {\n const orderA = groupOrder.get(a) ?? 99;\n const orderB = groupOrder.get(b) ?? 99;\n return orderA - orderB;\n });\n\n return sortedGroups;\n }, [allSections, registeredPlugins]);\n\n // Get current section's component\n const currentSection = useMemo(() => {\n if (!activeSection) return null;\n const [pluginId, sectionId] = activeSection.split(':') as [string, string];\n const plugin = registry.get(pluginId);\n if (!plugin) return null;\n const Component = plugin.components[sectionId];\n if (!Component) return null;\n const pluginContext = plugin.createPluginContext(hostContext);\n return { Component, pluginContext, plugin };\n }, [activeSection, registry, hostContext]);\n\n // Context value\n const contextValue = useMemo<AdminShellContextValue>(\n () => ({\n registry,\n hostContext,\n activeSection,\n setActiveSection,\n getPluginContext,\n }),\n [registry, hostContext, activeSection, setActiveSection, getPluginContext]\n );\n\n // Bridge hostContext.cedrosLogin into CedrosLoginContext so hooks\n // (useOrgs, useAdminDeposits, etc.) work inside AdminShell sections.\n const cedrosLoginContextValue = useMemo<CedrosLoginContextValue | null>(() => {\n const cl = hostContext.cedrosLogin;\n if (!cl) return null;\n const user: AuthUser | null = cl.user\n ? { authMethods: [], emailVerified: false, createdAt: '', updatedAt: '', ...cl.user }\n : null;\n return {\n config: { serverUrl: cl.serverUrl },\n user,\n authState: cl.user ? 'authenticated' : 'unauthenticated',\n error: null,\n logout: async () => {},\n refreshUser: async () => {},\n isModalOpen: false,\n openModal: () => {},\n closeModal: () => {},\n _internal: {\n handleLoginSuccess: () => {},\n getAccessToken: cl.getAccessToken,\n },\n };\n }, [hostContext.cedrosLogin]);\n\n return (\n <AdminShellContext.Provider value={contextValue}>\n <CedrosLoginContext.Provider value={cedrosLoginContextValue}>\n <div className={`cedros-admin cedros-admin-shell ${className || ''}`}>\n {/* Sidebar */}\n <aside className=\"cedros-admin-shell__sidebar\">\n <div className=\"cedros-admin-shell__sidebar-header\">\n {logo ?? (\n <div className=\"cedros-admin-shell__logo\">\n <span className=\"cedros-admin-shell__logo-text\">{title}</span>\n </div>\n )}\n </div>\n\n <nav className=\"cedros-admin-shell__nav\">\n {groupedSections.map(([groupName, sections]) => {\n const isCollapsible = groupName === 'Configuration';\n const isCollapsed = collapsedGroups.has(groupName);\n\n return (\n <div key={groupName} className=\"cedros-admin-shell__nav-group\">\n {isCollapsible ? (\n <button\n type=\"button\"\n className=\"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible\"\n onClick={() => toggleGroup(groupName)}\n aria-expanded={!isCollapsed}\n >\n <span>{groupName}</span>\n <span\n className={`cedros-admin-shell__nav-chevron ${!isCollapsed ? 'cedros-admin-shell__nav-chevron--expanded' : ''}`}\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </span>\n </button>\n ) : (\n <span className=\"cedros-admin-shell__nav-label\">{groupName}</span>\n )}\n {(!isCollapsible || !isCollapsed) &&\n sections\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n .map((section) => (\n <button\n key={section.qualifiedId}\n type=\"button\"\n className={`cedros-admin-shell__nav-item ${\n activeSection === section.qualifiedId\n ? 'cedros-admin-shell__nav-item--active'\n : ''\n }`}\n onClick={() => setActiveSection(section.qualifiedId)}\n aria-current={\n activeSection === section.qualifiedId ? 'page' : undefined\n }\n >\n <span className=\"cedros-admin-shell__nav-icon\">{section.icon}</span>\n <span className=\"cedros-admin-shell__nav-text\">{section.label}</span>\n {section.badge && (\n <span className=\"cedros-admin-shell__nav-badge\">{section.badge}</span>\n )}\n </button>\n ))}\n </div>\n );\n })}\n </nav>\n\n {/* User profile dropdown + optional custom footer */}\n {(hostContext.cedrosLogin?.user || sidebarFooter) && (\n <div className=\"cedros-admin-shell__sidebar-footer\">\n {hostContext.cedrosLogin?.user && (\n <ProfileDropdown\n name={hostContext.cedrosLogin.user.name}\n email={hostContext.cedrosLogin.user.email}\n picture={hostContext.cedrosLogin.user.picture}\n onSettings={onSettingsClick}\n onLogout={onLogoutClick}\n />\n )}\n {sidebarFooter}\n </div>\n )}\n </aside>\n\n {/* Main Content */}\n <main className=\"cedros-admin-shell__main\">\n {currentSection ? (\n <Suspense fallback={<LoadingFallback />}>\n <div\n className=\"cedros-admin-shell__section\"\n data-plugin-namespace={currentSection.plugin.cssNamespace}\n >\n <currentSection.Component\n pluginContext={currentSection.pluginContext}\n pageSize={pageSize}\n refreshInterval={refreshInterval}\n />\n </div>\n </Suspense>\n ) : (\n <div className=\"cedros-admin-shell__empty\">\n {allSections.length === 0\n ? 'No plugins loaded'\n : 'Select a section from the sidebar'}\n </div>\n )}\n </main>\n </div>\n </CedrosLoginContext.Provider>\n </AdminShellContext.Provider>\n );\n}\n\n// ============================================================================\n// Helper Components\n// ============================================================================\n\nfunction LoadingFallback(): React.JSX.Element {\n return (\n <div className=\"cedros-admin-shell__loading\">\n <LoadingSpinner />\n <span>Loading...</span>\n </div>\n );\n}\n","/**\n * Admin Dashboard Icons\n *\n * SVG icons for the admin dashboard sidebar and sections.\n * Lucide-style, 24x24 viewBox rendered at 16x16.\n */\n\nimport type { ReactNode } from 'react';\n\nconst iconProps = {\n width: '16',\n height: '16',\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: '2',\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n};\n\nexport const Icons: Record<string, ReactNode> = {\n users: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n members: (\n <svg {...iconProps}>\n <path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\" />\n </svg>\n ),\n\n invites: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n deposits: (\n <svg {...iconProps}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8\" />\n <path d=\"M12 18V6\" />\n </svg>\n ),\n\n withdrawals: (\n <svg {...iconProps}>\n <rect width=\"16\" height=\"20\" x=\"4\" y=\"2\" rx=\"2\" ry=\"2\" />\n <path d=\"M9 22v-4h6v4\" />\n <path d=\"M8 6h.01\" />\n <path d=\"M16 6h.01\" />\n <path d=\"M12 6h.01\" />\n <path d=\"M12 10h.01\" />\n <path d=\"M12 14h.01\" />\n <path d=\"M16 10h.01\" />\n <path d=\"M16 14h.01\" />\n <path d=\"M8 10h.01\" />\n <path d=\"M8 14h.01\" />\n </svg>\n ),\n\n settings: (\n <svg {...iconProps}>\n <path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ),\n\n wallet: (\n <svg {...iconProps}>\n <path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" />\n </svg>\n ),\n\n chevronRight: (\n <svg {...iconProps}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n ),\n\n // Settings sub-page icons\n key: (\n <svg {...iconProps}>\n <path d=\"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4\" />\n </svg>\n ),\n\n toggles: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"12\" x=\"2\" y=\"6\" rx=\"6\" />\n <circle cx=\"8\" cy=\"12\" r=\"2\" />\n </svg>\n ),\n\n shield: (\n <svg {...iconProps}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n ),\n\n mail: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\" />\n <path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\" />\n </svg>\n ),\n\n webhook: (\n <svg {...iconProps}>\n <path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" />\n </svg>\n ),\n\n coins: (\n <svg {...iconProps}>\n <circle cx=\"8\" cy=\"8\" r=\"6\" />\n <path d=\"M18.09 10.37A6 6 0 1 1 10.34 18\" />\n <path d=\"M7 6h1v4\" />\n <path d=\"m16.71 13.88.7.71-2.82 2.82\" />\n </svg>\n ),\n\n server: (\n <svg {...iconProps}>\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" />\n </svg>\n ),\n};\n","/**\n * Cedros Login Admin Plugin\n *\n * Exports the cedrosLoginPlugin for use with AdminShell.\n * Provides user management, deposits, withdrawals, and configuration sections.\n */\n\nimport { lazy } from 'react';\nimport type { AdminPlugin, HostContext, PluginContext, AdminSectionConfig } from './types';\nimport { Icons } from './icons';\n\n// ============================================================================\n// Lazy-loaded Section Components\n// ============================================================================\n\nconst UsersSection = lazy(() => import('./sections/UsersSection'));\nconst TeamSection = lazy(() => import('./sections/TeamSection'));\nconst DepositsSection = lazy(() => import('./sections/DepositsSection'));\nconst WithdrawalsSection = lazy(() => import('./sections/WithdrawalsSection'));\nconst AuthenticationSettings = lazy(() => import('./sections/AuthenticationSettings'));\nconst EmbeddedWalletSettings = lazy(() => import('./sections/EmbeddedWalletSettings'));\nconst EmailSettings = lazy(() => import('./sections/EmailSettings'));\nconst WebhookSettings = lazy(() => import('./sections/WebhookSettings'));\nconst CreditSystemSettings = lazy(() => import('./sections/CreditSystemSettings'));\nconst ServerSettings = lazy(() => import('./sections/ServerSettings'));\n\n// ============================================================================\n// Permission Mapping\n// ============================================================================\n\ntype LoginPermission =\n | 'login:users:read'\n | 'login:users:write'\n | 'login:members:read'\n | 'login:members:write'\n | 'login:invites:read'\n | 'login:invites:write'\n | 'login:deposits:read'\n | 'login:deposits:write'\n | 'login:settings:read'\n | 'login:settings:write';\n\n/**\n * Maps plugin permissions to org-level permissions/roles.\n */\nconst PERMISSION_MAP: Record<LoginPermission, string[]> = {\n 'login:users:read': ['admin', 'owner'],\n 'login:users:write': ['admin', 'owner'],\n 'login:members:read': ['member:read', 'admin', 'owner'],\n 'login:members:write': ['member:remove', 'member:role_change'],\n 'login:invites:read': ['invite:read', 'admin', 'owner'],\n 'login:invites:write': ['invite:create', 'invite:cancel'],\n 'login:deposits:read': ['admin', 'owner'],\n 'login:deposits:write': ['admin', 'owner'],\n 'login:settings:read': ['admin', 'owner'],\n 'login:settings:write': ['admin', 'owner'],\n};\n\n// ============================================================================\n// Section Configuration\n// ============================================================================\n\nconst SECTIONS: AdminSectionConfig[] = [\n // Users group (main sections)\n {\n id: 'users',\n label: 'Users',\n icon: Icons.users,\n group: 'Users',\n order: 0,\n requiredPermission: 'login:users:read',\n },\n {\n id: 'team',\n label: 'Team',\n icon: Icons.members,\n group: 'Users',\n order: 1,\n requiredPermission: 'login:members:read',\n },\n {\n id: 'deposits',\n label: 'Deposits',\n icon: Icons.deposits,\n group: 'Users',\n order: 2,\n requiredPermission: 'login:deposits:read',\n },\n {\n id: 'withdrawals',\n label: 'Withdrawals',\n icon: Icons.withdrawals,\n group: 'Users',\n order: 3,\n requiredPermission: 'login:deposits:read',\n },\n\n // Configuration group (settings sections)\n {\n id: 'settings-auth',\n label: 'Authentication',\n icon: Icons.key,\n group: 'Configuration',\n order: 0,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-email',\n label: 'Email & SMTP',\n icon: Icons.mail,\n group: 'Configuration',\n order: 1,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-webhooks',\n label: 'Webhooks',\n icon: Icons.webhook,\n group: 'Configuration',\n order: 2,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-wallet',\n label: 'User Wallets',\n icon: Icons.wallet,\n group: 'Configuration',\n order: 3,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-credits',\n label: 'Credit System',\n icon: Icons.coins,\n group: 'Configuration',\n order: 4,\n requiredPermission: 'login:settings:read',\n },\n {\n id: 'settings-server',\n label: 'Auth Server',\n icon: Icons.server,\n group: 'Configuration',\n order: 5,\n requiredPermission: 'login:settings:read',\n },\n];\n\n// ============================================================================\n// Plugin Definition\n// ============================================================================\n\nexport const cedrosLoginPlugin: AdminPlugin = {\n id: 'cedros-login',\n name: 'Cedros Login',\n version: '1.0.0',\n\n sections: SECTIONS,\n\n groups: [\n { id: 'users', label: 'Users', order: 0 },\n { id: 'configuration', label: 'Configuration', order: 2 },\n ],\n\n components: {\n users: UsersSection,\n team: TeamSection,\n deposits: DepositsSection,\n withdrawals: WithdrawalsSection,\n 'settings-auth': AuthenticationSettings,\n 'settings-wallet': EmbeddedWalletSettings,\n 'settings-email': EmailSettings,\n 'settings-webhooks': WebhookSettings,\n 'settings-credits': CreditSystemSettings,\n 'settings-server': ServerSettings,\n },\n\n createPluginContext(hostContext: HostContext): PluginContext {\n const cedrosLogin = hostContext.cedrosLogin;\n if (!cedrosLogin) {\n throw new Error('cedros-login plugin requires cedrosLogin in hostContext');\n }\n\n return {\n serverUrl: cedrosLogin.serverUrl,\n userId: cedrosLogin.user?.id,\n getAccessToken: cedrosLogin.getAccessToken,\n hasPermission: (permission) => this.checkPermission(permission, hostContext),\n orgId: hostContext.org?.orgId,\n pluginData: {\n user: cedrosLogin.user,\n orgRole: hostContext.org?.role,\n },\n };\n },\n\n checkPermission(permission: string, hostContext: HostContext): boolean {\n const org = hostContext.org;\n\n // No org context = admin-level access (for global admins)\n if (!org) {\n // Check if user is in cedrosLogin context - assume admin if present\n return Boolean(hostContext.cedrosLogin?.user);\n }\n\n const requiredPerms = PERMISSION_MAP[permission as LoginPermission];\n if (!requiredPerms) {\n // Unknown permission - default deny\n return false;\n }\n\n // Check if user has any of the required permissions\n return requiredPerms.some(\n (p) =>\n org.permissions.includes(p) ||\n p === org.role ||\n (p === 'admin' && ['admin', 'owner'].includes(org.role)) ||\n (p === 'owner' && org.role === 'owner')\n );\n },\n\n cssNamespace: 'cedros-dashboard',\n};\n\n// Named export for convenience\nexport { cedrosLoginPlugin as loginPlugin };\n"],"names":["ProfileDropdown","name","email","picture","onSettings","onLogout","className","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","handleSettings","useCallback","handleLogout","displayName","initial","jsxs","jsx","PluginRegistryImpl","plugin","pluginId","listener","plugins","AdminShellContext","createContext","useAdminShell","ctx","useContext","buildGroupOrder","order","group","AdminShell","title","initialPlugins","hostContext","defaultSection","pageSize","refreshInterval","onSectionChange","logo","sidebarFooter","onSettingsClick","onLogoutClick","registry","reg","p","registeredPlugins","setRegisteredPlugins","allSections","useMemo","section","activeSection","setActiveSectionInternal","collapsedGroups","setCollapsedGroups","toggleGroup","groupName","prev","next","s","setActiveSection","getPluginContext","groupedSections","groupOrder","groups","existing","a","b","orderA","orderB","currentSection","sectionId","Component","pluginContext","contextValue","cedrosLoginContextValue","cl","user","CedrosLoginContext","sections","isCollapsible","isCollapsed","Suspense","LoadingFallback","LoadingSpinner","iconProps","Icons","UsersSection","lazy","TeamSection","DepositsSection","WithdrawalsSection","AuthenticationSettings","EmbeddedWalletSettings","EmailSettings","WebhookSettings","CreditSystemSettings","ServerSettings","PERMISSION_MAP","SECTIONS","cedrosLoginPlugin","cedrosLogin","permission","org","requiredPerms"],"mappings":";;;AAqCO,SAASA,EAAgB;AAAA,EAC9B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAAyB;AACvB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAcC,EAAuB,IAAI;AAG/C,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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AAQA,EAAY,MAAM;AAAA,MAC1B,gBAAgBA,EAAY;AAAA,MAC5B,eAAe,CAACC,MAAe,KAAK,gBAAgBA,GAAYpE,CAAW;AAAA,MAC3E,OAAOA,EAAY,KAAK;AAAA,MACxB,YAAY;AAAA,QACV,MAAMmE,EAAY;AAAA,QAClB,SAASnE,EAAY,KAAK;AAAA,MAAA;AAAA,IAC5B;AAAA,EAEJ;AAAA,EAEA,gBAAgBoE,GAAoBpE,GAAmC;AACrE,UAAMqE,IAAMrE,EAAY;AAGxB,QAAI,CAACqE;AAEH,aAAO,EAAQrE,EAAY,aAAa;AAG1C,UAAMsE,IAAgBN,GAAeI,CAA6B;AAClE,WAAKE,IAMEA,EAAc;AAAA,MACnB,CAAC3D,MACC0D,EAAI,YAAY,SAAS1D,CAAC,KAC1BA,MAAM0D,EAAI,QACT1D,MAAM,WAAW,CAAC,SAAS,OAAO,EAAE,SAAS0D,EAAI,IAAI,KACrD1D,MAAM,WAAW0D,EAAI,SAAS;AAAA,IAAA,IAT1B;AAAA,EAWX;AAAA,EAEA,cAAc;AAChB;"}
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),n=require("react"),C=require("./LoadingSpinner-d6sSxgQN.cjs");function A({name:a,email:i,picture:r,onSettings:c,onLogout:p,className:P=""}){const[u,j]=n.useState(!1),w=n.useRef(null);n.useEffect(()=>{function x(_){w.current&&!w.current.contains(_.target)&&j(!1)}if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]),n.useEffect(()=>{function x(_){_.key==="Escape"&&j(!1)}if(u)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[u]);const S=n.useCallback(()=>{j(!1),c?.()},[c]),M=n.useCallback(()=>{j(!1),p?.()},[p]),y=a||"User",h=(a?.[0]||i?.[0]||"?").toUpperCase();return e.jsxs("div",{className:`cedros-profile-dropdown ${P}`,ref:w,children:[e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__trigger",onClick:()=>j(!u),"aria-expanded":u,"aria-haspopup":"menu",children:[e.jsx("div",{className:"cedros-profile-dropdown__avatar",children:r?e.jsx("img",{src:r,alt:y,className:"cedros-profile-dropdown__avatar-img",referrerPolicy:"no-referrer"}):e.jsx("span",{className:"cedros-profile-dropdown__avatar-placeholder",children:h})}),e.jsxs("div",{className:"cedros-profile-dropdown__info",children:[e.jsx("span",{className:"cedros-profile-dropdown__name",children:y}),i&&e.jsx("span",{className:"cedros-profile-dropdown__email",children:i})]}),e.jsx("svg",{className:`cedros-profile-dropdown__chevron ${u?"cedros-profile-dropdown__chevron--open":""}`,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),u&&e.jsxs("div",{className:"cedros-profile-dropdown__menu",role:"menu",children:[c&&e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__item",onClick:S,role:"menuitem",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"Settings"]}),p&&e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger",onClick:M,role:"menuitem",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",x2:"9",y1:"12",y2:"12"})]}),"Log out"]})]})]})}class T{plugins=new Map;listeners=new Set;register(i){this.plugins.has(i.id)&&console.warn(`Plugin ${i.id} already registered, replacing...`),this.plugins.set(i.id,i),i.onRegister?.(this),this.notify()}unregister(i){const r=this.plugins.get(i);r&&(r.onUnregister?.(),this.plugins.delete(i),this.notify())}get(i){return this.plugins.get(i)}getAll(){return Array.from(this.plugins.values())}subscribe(i){return this.listeners.add(i),()=>this.listeners.delete(i)}notify(){const i=this.getAll();this.listeners.forEach(r=>r(i))}}const I=n.createContext(null);function $(){const a=n.useContext(I);if(!a)throw new Error("useAdminShell must be used within AdminShell");return a}function B(a){const i=new Map;for(const r of a)for(const c of r.groups??[])i.has(c.label)||i.set(c.label,c.order);return i}function G({title:a="Admin",plugins:i=[],hostContext:r,defaultSection:c,pageSize:p=20,refreshInterval:P=0,onSectionChange:u,logo:j,sidebarFooter:w,onSettingsClick:S,onLogoutClick:M,className:y=""}){const[h]=n.useState(()=>{const s=new T;return i.forEach(o=>s.register(o)),s}),[x,_]=n.useState(()=>h.getAll());n.useEffect(()=>h.subscribe(_),[h]);const f=n.useMemo(()=>x.flatMap(s=>s.sections.filter(o=>!(o.requiredPermission&&!s.checkPermission(o.requiredPermission,r)||r.dashboardPermissions&&!r.dashboardPermissions.canAccess(o.id))).map(o=>({...o,qualifiedId:`${s.id}:${o.id}`,pluginId:s.id,cssNamespace:s.cssNamespace}))),[x,r]),[v,q]=n.useState(()=>c??f[0]?.qualifiedId??null),[E,U]=n.useState(new Set),z=n.useCallback(s=>{U(o=>{const d=new Set(o);return d.has(s)?d.delete(s):d.add(s),d})},[]);n.useEffect(()=>{v&&!f.find(s=>s.qualifiedId===v)&&q(f[0]?.qualifiedId??null)},[f,v]);const L=n.useCallback(s=>{q(s),u?.(s)},[u]),N=n.useCallback(s=>{const o=h.get(s);return o?o.createPluginContext(r):null},[h,r]),V=n.useMemo(()=>{const s=B(x),o=new Map;return f.forEach(g=>{const l=g.group??"Menu",b=o.get(l)??[];o.set(l,[...b,g])}),Array.from(o.entries()).sort(([g],[l])=>{const b=s.get(g)??99,O=s.get(l)??99;return b-O})},[f,x]),k=n.useMemo(()=>{if(!v)return null;const[s,o]=v.split(":"),d=h.get(s);if(!d)return null;const g=d.components[o];if(!g)return null;const l=d.createPluginContext(r);return{Component:g,pluginContext:l,plugin:d}},[v,h,r]),W=n.useMemo(()=>({registry:h,hostContext:r,activeSection:v,setActiveSection:L,getPluginContext:N}),[h,r,v,L,N]),R=n.useMemo(()=>{const s=r.cedrosLogin;if(!s)return null;const o=s.user?{authMethods:[],emailVerified:!1,createdAt:"",updatedAt:"",...s.user}:null;return{config:{serverUrl:s.serverUrl},user:o,authState:s.user?"authenticated":"unauthenticated",error:null,logout:async()=>{},refreshUser:async()=>{},isModalOpen:!1,openModal:()=>{},closeModal:()=>{},_internal:{handleLoginSuccess:()=>{},getAccessToken:s.getAccessToken}}},[r.cedrosLogin]);return e.jsx(I.Provider,{value:W,children:e.jsx(C.CedrosLoginContext.Provider,{value:R,children:e.jsxs("div",{className:`cedros-admin cedros-admin-shell ${y||""}`,children:[e.jsxs("aside",{className:"cedros-admin-shell__sidebar",children:[e.jsx("div",{className:"cedros-admin-shell__sidebar-header",children:j??e.jsx("div",{className:"cedros-admin-shell__logo",children:e.jsx("span",{className:"cedros-admin-shell__logo-text",children:a})})}),e.jsx("nav",{className:"cedros-admin-shell__nav",children:V.map(([s,o])=>{const d=s==="Configuration",g=E.has(s);return e.jsxs("div",{className:"cedros-admin-shell__nav-group",children:[d?e.jsxs("button",{type:"button",className:"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible",onClick:()=>z(s),"aria-expanded":!g,children:[e.jsx("span",{children:s}),e.jsx("span",{className:`cedros-admin-shell__nav-chevron ${g?"":"cedros-admin-shell__nav-chevron--expanded"}`,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})})]}):e.jsx("span",{className:"cedros-admin-shell__nav-label",children:s}),(!d||!g)&&o.sort((l,b)=>(l.order??0)-(b.order??0)).map(l=>e.jsxs("button",{type:"button",className:`cedros-admin-shell__nav-item ${v===l.qualifiedId?"cedros-admin-shell__nav-item--active":""}`,onClick:()=>L(l.qualifiedId),"aria-current":v===l.qualifiedId?"page":void 0,children:[e.jsx("span",{className:"cedros-admin-shell__nav-icon",children:l.icon}),e.jsx("span",{className:"cedros-admin-shell__nav-text",children:l.label}),l.badge&&e.jsx("span",{className:"cedros-admin-shell__nav-badge",children:l.badge})]},l.qualifiedId))]},s)})}),(r.cedrosLogin?.user||w)&&e.jsxs("div",{className:"cedros-admin-shell__sidebar-footer",children:[r.cedrosLogin?.user&&e.jsx(A,{name:r.cedrosLogin.user.name,email:r.cedrosLogin.user.email,picture:r.cedrosLogin.user.picture,onSettings:S,onLogout:M}),w]})]}),e.jsx("main",{className:"cedros-admin-shell__main",children:k?e.jsx(n.Suspense,{fallback:e.jsx(D,{}),children:e.jsx("div",{className:"cedros-admin-shell__section","data-plugin-namespace":k.plugin.cssNamespace,children:e.jsx(k.Component,{pluginContext:k.pluginContext,pageSize:p,refreshInterval:P})})}):e.jsx("div",{className:"cedros-admin-shell__empty",children:f.length===0?"No plugins loaded":"Select a section from the sidebar"})})]})})})}function D(){return e.jsxs("div",{className:"cedros-admin-shell__loading",children:[e.jsx(C.LoadingSpinner,{}),e.jsx("span",{children:"Loading..."})]})}const t={width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m={users:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),members:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),invites:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),deposits:e.jsxs("svg",{...t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"}),e.jsx("path",{d:"M12 18V6"})]}),withdrawals:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}),e.jsx("path",{d:"M9 22v-4h6v4"}),e.jsx("path",{d:"M8 6h.01"}),e.jsx("path",{d:"M16 6h.01"}),e.jsx("path",{d:"M12 6h.01"}),e.jsx("path",{d:"M12 10h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 10h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 10h.01"}),e.jsx("path",{d:"M8 14h.01"})]}),settings:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),wallet:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),e.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),chevronRight:e.jsx("svg",{...t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),key:e.jsx("svg",{...t,children:e.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})}),toggles:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"12",x:"2",y:"6",rx:"6"}),e.jsx("circle",{cx:"8",cy:"12",r:"2"})]}),shield:e.jsx("svg",{...t,children:e.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),mail:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),webhook:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2"}),e.jsx("path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06"}),e.jsx("path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8"})]}),coins:e.jsxs("svg",{...t,children:[e.jsx("circle",{cx:"8",cy:"8",r:"6"}),e.jsx("path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18"}),e.jsx("path",{d:"M7 6h1v4"}),e.jsx("path",{d:"m16.71 13.88.7.71-2.82 2.82"})]}),server:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),e.jsx("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),e.jsx("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})},H=n.lazy(()=>Promise.resolve().then(()=>require("./UsersSection-e6q7FHzx.cjs"))),F=n.lazy(()=>Promise.resolve().then(()=>require("./TeamSection-BOH9pv_E.cjs"))),J=n.lazy(()=>Promise.resolve().then(()=>require("./DepositsSection-BkKUS4vk.cjs"))),K=n.lazy(()=>Promise.resolve().then(()=>require("./WithdrawalsSection-sljIyeaz.cjs"))),Q=n.lazy(()=>Promise.resolve().then(()=>require("./AuthenticationSettings-D739nNul.cjs"))),X=n.lazy(()=>Promise.resolve().then(()=>require("./EmbeddedWalletSettings-D5JXae1L.cjs"))),Y=n.lazy(()=>Promise.resolve().then(()=>require("./EmailSettings-B9qwPSiM.cjs"))),Z=n.lazy(()=>Promise.resolve().then(()=>require("./WebhookSettings-CGyDKjrm.cjs"))),ee=n.lazy(()=>Promise.resolve().then(()=>require("./CreditSystemSettings-C6dUsu72.cjs"))),se=n.lazy(()=>Promise.resolve().then(()=>require("./ServerSettings-CYTlQ2xy.cjs"))),re={"login:users:read":["admin","owner"],"login:users:write":["admin","owner"],"login:members:read":["member:read","admin","owner"],"login:members:write":["member:remove","member:role_change"],"login:invites:read":["invite:read","admin","owner"],"login:invites:write":["invite:create","invite:cancel"],"login:deposits:read":["admin","owner"],"login:deposits:write":["admin","owner"],"login:settings:read":["admin","owner"],"login:settings:write":["admin","owner"]},ie=[{id:"users",label:"Users",icon:m.users,group:"Users",order:0,requiredPermission:"login:users:read"},{id:"team",label:"Team",icon:m.members,group:"Users",order:1,requiredPermission:"login:members:read"},{id:"deposits",label:"Deposits",icon:m.deposits,group:"Users",order:2,requiredPermission:"login:deposits:read"},{id:"withdrawals",label:"Withdrawals",icon:m.withdrawals,group:"Users",order:3,requiredPermission:"login:deposits:read"},{id:"settings-auth",label:"Authentication",icon:m.key,group:"Configuration",order:0,requiredPermission:"login:settings:read"},{id:"settings-email",label:"Email & SMTP",icon:m.mail,group:"Configuration",order:1,requiredPermission:"login:settings:read"},{id:"settings-webhooks",label:"Webhooks",icon:m.webhook,group:"Configuration",order:2,requiredPermission:"login:settings:read"},{id:"settings-wallet",label:"User Wallets",icon:m.wallet,group:"Configuration",order:3,requiredPermission:"login:settings:read"},{id:"settings-credits",label:"Credit System",icon:m.coins,group:"Configuration",order:4,requiredPermission:"login:settings:read"},{id:"settings-server",label:"Auth Server",icon:m.server,group:"Configuration",order:5,requiredPermission:"login:settings:read"}],ne={id:"cedros-login",name:"Cedros Login",version:"1.0.0",sections:ie,groups:[{id:"users",label:"Users",order:0},{id:"configuration",label:"Configuration",order:2}],components:{users:H,team:F,deposits:J,withdrawals:K,"settings-auth":Q,"settings-wallet":X,"settings-email":Y,"settings-webhooks":Z,"settings-credits":ee,"settings-server":se},createPluginContext(a){const i=a.cedrosLogin;if(!i)throw new Error("cedros-login plugin requires cedrosLogin in hostContext");return{serverUrl:i.serverUrl,userId:i.user?.id,getAccessToken:i.getAccessToken,hasPermission:r=>this.checkPermission(r,a),orgId:a.org?.orgId,pluginData:{user:i.user,orgRole:a.org?.role}}},checkPermission(a,i){const r=i.org;if(!r)return!!i.cedrosLogin?.user;const c=re[a];return c?c.some(p=>r.permissions.includes(p)||p===r.role||p==="admin"&&["admin","owner"].includes(r.role)||p==="owner"&&r.role==="owner"):!1},cssNamespace:"cedros-dashboard"};exports.AdminShell=G;exports.Icons=m;exports.ProfileDropdown=A;exports.cedrosLoginPlugin=ne;exports.useAdminShell=$;
1
+ "use strict";const e=require("react/jsx-runtime"),n=require("react"),C=require("./LoadingSpinner-d6sSxgQN.cjs");function A({name:a,email:i,picture:r,onSettings:c,onLogout:p,className:P=""}){const[u,j]=n.useState(!1),w=n.useRef(null);n.useEffect(()=>{function x(_){w.current&&!w.current.contains(_.target)&&j(!1)}if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]),n.useEffect(()=>{function x(_){_.key==="Escape"&&j(!1)}if(u)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[u]);const S=n.useCallback(()=>{j(!1),c?.()},[c]),M=n.useCallback(()=>{j(!1),p?.()},[p]),y=a||"User",h=(a?.[0]||i?.[0]||"?").toUpperCase();return e.jsxs("div",{className:`cedros-profile-dropdown ${P}`,ref:w,children:[e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__trigger",onClick:()=>j(!u),"aria-expanded":u,"aria-haspopup":"menu",children:[e.jsx("div",{className:"cedros-profile-dropdown__avatar",children:r?e.jsx("img",{src:r,alt:y,className:"cedros-profile-dropdown__avatar-img",referrerPolicy:"no-referrer"}):e.jsx("span",{className:"cedros-profile-dropdown__avatar-placeholder",children:h})}),e.jsxs("div",{className:"cedros-profile-dropdown__info",children:[e.jsx("span",{className:"cedros-profile-dropdown__name",children:y}),i&&e.jsx("span",{className:"cedros-profile-dropdown__email",children:i})]}),e.jsx("svg",{className:`cedros-profile-dropdown__chevron ${u?"cedros-profile-dropdown__chevron--open":""}`,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),u&&e.jsxs("div",{className:"cedros-profile-dropdown__menu",role:"menu",children:[c&&e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__item",onClick:S,role:"menuitem",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"Settings"]}),p&&e.jsxs("button",{type:"button",className:"cedros-profile-dropdown__item cedros-profile-dropdown__item--danger",onClick:M,role:"menuitem",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",x2:"9",y1:"12",y2:"12"})]}),"Log out"]})]})]})}class T{plugins=new Map;listeners=new Set;register(i){this.plugins.has(i.id)&&console.warn(`Plugin ${i.id} already registered, replacing...`),this.plugins.set(i.id,i),i.onRegister?.(this),this.notify()}unregister(i){const r=this.plugins.get(i);r&&(r.onUnregister?.(),this.plugins.delete(i),this.notify())}get(i){return this.plugins.get(i)}getAll(){return Array.from(this.plugins.values())}subscribe(i){return this.listeners.add(i),()=>this.listeners.delete(i)}notify(){const i=this.getAll();this.listeners.forEach(r=>r(i))}}const I=n.createContext(null);function $(){const a=n.useContext(I);if(!a)throw new Error("useAdminShell must be used within AdminShell");return a}function B(a){const i=new Map;for(const r of a)for(const c of r.groups??[])i.has(c.label)||i.set(c.label,c.order);return i}function G({title:a="Admin",plugins:i=[],hostContext:r,defaultSection:c,pageSize:p=20,refreshInterval:P=0,onSectionChange:u,logo:j,sidebarFooter:w,onSettingsClick:S,onLogoutClick:M,className:y=""}){const[h]=n.useState(()=>{const s=new T;return i.forEach(o=>s.register(o)),s}),[x,_]=n.useState(()=>h.getAll());n.useEffect(()=>h.subscribe(_),[h]);const f=n.useMemo(()=>x.flatMap(s=>s.sections.filter(o=>!(o.requiredPermission&&!s.checkPermission(o.requiredPermission,r)||r.dashboardPermissions&&!r.dashboardPermissions.canAccess(o.id))).map(o=>({...o,qualifiedId:`${s.id}:${o.id}`,pluginId:s.id,cssNamespace:s.cssNamespace}))),[x,r]),[v,q]=n.useState(()=>c??f[0]?.qualifiedId??null),[E,U]=n.useState(new Set),z=n.useCallback(s=>{U(o=>{const d=new Set(o);return d.has(s)?d.delete(s):d.add(s),d})},[]);n.useEffect(()=>{v&&!f.find(s=>s.qualifiedId===v)&&q(f[0]?.qualifiedId??null)},[f,v]);const L=n.useCallback(s=>{q(s),u?.(s)},[u]),N=n.useCallback(s=>{const o=h.get(s);return o?o.createPluginContext(r):null},[h,r]),V=n.useMemo(()=>{const s=B(x),o=new Map;return f.forEach(g=>{const l=g.group??"Menu",b=o.get(l)??[];o.set(l,[...b,g])}),Array.from(o.entries()).sort(([g],[l])=>{const b=s.get(g)??99,O=s.get(l)??99;return b-O})},[f,x]),k=n.useMemo(()=>{if(!v)return null;const[s,o]=v.split(":"),d=h.get(s);if(!d)return null;const g=d.components[o];if(!g)return null;const l=d.createPluginContext(r);return{Component:g,pluginContext:l,plugin:d}},[v,h,r]),W=n.useMemo(()=>({registry:h,hostContext:r,activeSection:v,setActiveSection:L,getPluginContext:N}),[h,r,v,L,N]),R=n.useMemo(()=>{const s=r.cedrosLogin;if(!s)return null;const o=s.user?{authMethods:[],emailVerified:!1,createdAt:"",updatedAt:"",...s.user}:null;return{config:{serverUrl:s.serverUrl},user:o,authState:s.user?"authenticated":"unauthenticated",error:null,logout:async()=>{},refreshUser:async()=>{},isModalOpen:!1,openModal:()=>{},closeModal:()=>{},_internal:{handleLoginSuccess:()=>{},getAccessToken:s.getAccessToken}}},[r.cedrosLogin]);return e.jsx(I.Provider,{value:W,children:e.jsx(C.CedrosLoginContext.Provider,{value:R,children:e.jsxs("div",{className:`cedros-admin cedros-admin-shell ${y||""}`,children:[e.jsxs("aside",{className:"cedros-admin-shell__sidebar",children:[e.jsx("div",{className:"cedros-admin-shell__sidebar-header",children:j??e.jsx("div",{className:"cedros-admin-shell__logo",children:e.jsx("span",{className:"cedros-admin-shell__logo-text",children:a})})}),e.jsx("nav",{className:"cedros-admin-shell__nav",children:V.map(([s,o])=>{const d=s==="Configuration",g=E.has(s);return e.jsxs("div",{className:"cedros-admin-shell__nav-group",children:[d?e.jsxs("button",{type:"button",className:"cedros-admin-shell__nav-label cedros-admin-shell__nav-label--collapsible",onClick:()=>z(s),"aria-expanded":!g,children:[e.jsx("span",{children:s}),e.jsx("span",{className:`cedros-admin-shell__nav-chevron ${g?"":"cedros-admin-shell__nav-chevron--expanded"}`,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})})]}):e.jsx("span",{className:"cedros-admin-shell__nav-label",children:s}),(!d||!g)&&o.sort((l,b)=>(l.order??0)-(b.order??0)).map(l=>e.jsxs("button",{type:"button",className:`cedros-admin-shell__nav-item ${v===l.qualifiedId?"cedros-admin-shell__nav-item--active":""}`,onClick:()=>L(l.qualifiedId),"aria-current":v===l.qualifiedId?"page":void 0,children:[e.jsx("span",{className:"cedros-admin-shell__nav-icon",children:l.icon}),e.jsx("span",{className:"cedros-admin-shell__nav-text",children:l.label}),l.badge&&e.jsx("span",{className:"cedros-admin-shell__nav-badge",children:l.badge})]},l.qualifiedId))]},s)})}),(r.cedrosLogin?.user||w)&&e.jsxs("div",{className:"cedros-admin-shell__sidebar-footer",children:[r.cedrosLogin?.user&&e.jsx(A,{name:r.cedrosLogin.user.name,email:r.cedrosLogin.user.email,picture:r.cedrosLogin.user.picture,onSettings:S,onLogout:M}),w]})]}),e.jsx("main",{className:"cedros-admin-shell__main",children:k?e.jsx(n.Suspense,{fallback:e.jsx(D,{}),children:e.jsx("div",{className:"cedros-admin-shell__section","data-plugin-namespace":k.plugin.cssNamespace,children:e.jsx(k.Component,{pluginContext:k.pluginContext,pageSize:p,refreshInterval:P})})}):e.jsx("div",{className:"cedros-admin-shell__empty",children:f.length===0?"No plugins loaded":"Select a section from the sidebar"})})]})})})}function D(){return e.jsxs("div",{className:"cedros-admin-shell__loading",children:[e.jsx(C.LoadingSpinner,{}),e.jsx("span",{children:"Loading..."})]})}const t={width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},m={users:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),members:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),invites:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),deposits:e.jsxs("svg",{...t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"}),e.jsx("path",{d:"M12 18V6"})]}),withdrawals:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2"}),e.jsx("path",{d:"M9 22v-4h6v4"}),e.jsx("path",{d:"M8 6h.01"}),e.jsx("path",{d:"M16 6h.01"}),e.jsx("path",{d:"M12 6h.01"}),e.jsx("path",{d:"M12 10h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 10h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 10h.01"}),e.jsx("path",{d:"M8 14h.01"})]}),settings:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),wallet:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),e.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),chevronRight:e.jsx("svg",{...t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),key:e.jsx("svg",{...t,children:e.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})}),toggles:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"12",x:"2",y:"6",rx:"6"}),e.jsx("circle",{cx:"8",cy:"12",r:"2"})]}),shield:e.jsx("svg",{...t,children:e.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),mail:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),webhook:e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2"}),e.jsx("path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06"}),e.jsx("path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8"})]}),coins:e.jsxs("svg",{...t,children:[e.jsx("circle",{cx:"8",cy:"8",r:"6"}),e.jsx("path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18"}),e.jsx("path",{d:"M7 6h1v4"}),e.jsx("path",{d:"m16.71 13.88.7.71-2.82 2.82"})]}),server:e.jsxs("svg",{...t,children:[e.jsx("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),e.jsx("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),e.jsx("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})},H=n.lazy(()=>Promise.resolve().then(()=>require("./UsersSection-e6q7FHzx.cjs"))),F=n.lazy(()=>Promise.resolve().then(()=>require("./TeamSection-BOH9pv_E.cjs"))),J=n.lazy(()=>Promise.resolve().then(()=>require("./DepositsSection-BkKUS4vk.cjs"))),K=n.lazy(()=>Promise.resolve().then(()=>require("./WithdrawalsSection-sljIyeaz.cjs"))),Q=n.lazy(()=>Promise.resolve().then(()=>require("./AuthenticationSettings-CjGGqbcS.cjs"))),X=n.lazy(()=>Promise.resolve().then(()=>require("./EmbeddedWalletSettings-YX0Dk_b_.cjs"))),Y=n.lazy(()=>Promise.resolve().then(()=>require("./EmailSettings-Bup2rCgU.cjs"))),Z=n.lazy(()=>Promise.resolve().then(()=>require("./WebhookSettings-BMeykdRP.cjs"))),ee=n.lazy(()=>Promise.resolve().then(()=>require("./CreditSystemSettings-BykhytcS.cjs"))),se=n.lazy(()=>Promise.resolve().then(()=>require("./ServerSettings-CInJe4jY.cjs"))),re={"login:users:read":["admin","owner"],"login:users:write":["admin","owner"],"login:members:read":["member:read","admin","owner"],"login:members:write":["member:remove","member:role_change"],"login:invites:read":["invite:read","admin","owner"],"login:invites:write":["invite:create","invite:cancel"],"login:deposits:read":["admin","owner"],"login:deposits:write":["admin","owner"],"login:settings:read":["admin","owner"],"login:settings:write":["admin","owner"]},ie=[{id:"users",label:"Users",icon:m.users,group:"Users",order:0,requiredPermission:"login:users:read"},{id:"team",label:"Team",icon:m.members,group:"Users",order:1,requiredPermission:"login:members:read"},{id:"deposits",label:"Deposits",icon:m.deposits,group:"Users",order:2,requiredPermission:"login:deposits:read"},{id:"withdrawals",label:"Withdrawals",icon:m.withdrawals,group:"Users",order:3,requiredPermission:"login:deposits:read"},{id:"settings-auth",label:"Authentication",icon:m.key,group:"Configuration",order:0,requiredPermission:"login:settings:read"},{id:"settings-email",label:"Email & SMTP",icon:m.mail,group:"Configuration",order:1,requiredPermission:"login:settings:read"},{id:"settings-webhooks",label:"Webhooks",icon:m.webhook,group:"Configuration",order:2,requiredPermission:"login:settings:read"},{id:"settings-wallet",label:"User Wallets",icon:m.wallet,group:"Configuration",order:3,requiredPermission:"login:settings:read"},{id:"settings-credits",label:"Credit System",icon:m.coins,group:"Configuration",order:4,requiredPermission:"login:settings:read"},{id:"settings-server",label:"Auth Server",icon:m.server,group:"Configuration",order:5,requiredPermission:"login:settings:read"}],ne={id:"cedros-login",name:"Cedros Login",version:"1.0.0",sections:ie,groups:[{id:"users",label:"Users",order:0},{id:"configuration",label:"Configuration",order:2}],components:{users:H,team:F,deposits:J,withdrawals:K,"settings-auth":Q,"settings-wallet":X,"settings-email":Y,"settings-webhooks":Z,"settings-credits":ee,"settings-server":se},createPluginContext(a){const i=a.cedrosLogin;if(!i)throw new Error("cedros-login plugin requires cedrosLogin in hostContext");return{serverUrl:i.serverUrl,userId:i.user?.id,getAccessToken:i.getAccessToken,hasPermission:r=>this.checkPermission(r,a),orgId:a.org?.orgId,pluginData:{user:i.user,orgRole:a.org?.role}}},checkPermission(a,i){const r=i.org;if(!r)return!!i.cedrosLogin?.user;const c=re[a];return c?c.some(p=>r.permissions.includes(p)||p===r.role||p==="admin"&&["admin","owner"].includes(r.role)||p==="owner"&&r.role==="owner"):!1},cssNamespace:"cedros-dashboard"};exports.AdminShell=G;exports.Icons=m;exports.ProfileDropdown=A;exports.cedrosLoginPlugin=ne;exports.useAdminShell=$;