@fayz-ai/ui 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XKFYX3DG.js → chunk-425EWIQL.js} +4 -4
- package/dist/{chunk-XKFYX3DG.js.map → chunk-425EWIQL.js.map} +1 -1
- package/dist/{chunk-RRNMNFLF.js → chunk-43DUMVRU.js} +10 -4
- package/dist/chunk-43DUMVRU.js.map +1 -0
- package/dist/{chunk-G73HZNFI.js → chunk-BKTN6HDM.js} +80 -7
- package/dist/{chunk-G73HZNFI.js.map → chunk-BKTN6HDM.js.map} +1 -1
- package/dist/{chunk-UP7WVKSU.js → chunk-SGK3K3AQ.js} +3 -3
- package/dist/{chunk-UP7WVKSU.js.map → chunk-SGK3K3AQ.js.map} +1 -1
- package/dist/{chunk-HO2P2XB4.js → chunk-STWAQCYV.js} +3 -3
- package/dist/{chunk-HO2P2XB4.js.map → chunk-STWAQCYV.js.map} +1 -1
- package/dist/{chunk-L4TXDKMN.js → chunk-Z32UKXDM.js} +3 -3
- package/dist/{chunk-L4TXDKMN.js.map → chunk-Z32UKXDM.js.map} +1 -1
- package/dist/dashboard/index.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/layout/Sidebar.d.ts +4 -0
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/index.js +3 -3
- package/dist/layout/rail-flyout.d.ts +4 -0
- package/dist/layout/rail-flyout.d.ts.map +1 -1
- package/dist/primitives/dictate-button.d.ts +18 -0
- package/dist/primitives/dictate-button.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +4 -4
- package/package.json +2 -2
- package/dist/chunk-RRNMNFLF.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/layout/SaveBar.tsx","../src/stores/page-header.store.ts","../src/layout/useCrossModuleBack.ts","../src/primitives/page-header.tsx","../src/stores/layout.store.ts","../src/layout/ShellSearch.tsx","../src/layout/rail-flyout.tsx","../src/layout/Sidebar.tsx","../src/layout/Topbar.tsx","../src/layout/AppShell.tsx"],"names":["React2","jsx","jsxs","Fragment","React3","create","React4","React5","content","useIsomorphicLayoutEffect","React6","ExternalLink","Crown","React7","Settings","getIcon","Home","ChevronDown","Search","React8","Menu","Sparkles"],"mappings":";;;;;;;;;;AAyDA,IAAM,iBAAA,GAA0B,oBAAiC,IAAI,CAAA;AACrE,IAAM,sBAA4B,KAAA,CAAA,aAAA,CAA4B,EAAE,SAAS,KAAA,EAAO,MAAA,EAAQ,OAAO,CAAA;AAK/F,IAAI,eAAA,GAAkB,KAAA;AACtB,IAAM,YAAA,uBAAmB,GAAA,EAAgB;AACzC,SAAS,wBAAwB,CAAA,EAAY;AAC3C,EAAA,IAAI,MAAM,eAAA,EAAiB;AAC3B,EAAA,eAAA,GAAkB,CAAA;AAClB,EAAA,YAAA,CAAa,OAAA,CAAQ,CAAC,EAAA,KAAO,EAAA,EAAI,CAAA;AACnC;AAGO,SAAS,iBAAA,GAA6B;AAC3C,EAAA,OAAa,KAAA,CAAA,oBAAA;AAAA,IACX,CAAC,EAAA,KAAO;AAAE,MAAA,YAAA,CAAa,IAAI,EAAE,CAAA;AAAG,MAAA,OAAO,MAAM;AAAE,QAAA,YAAA,CAAa,OAAO,EAAE,CAAA;AAAA,MAAE,CAAA;AAAA,IAAE,CAAA;AAAA,IACzE,MAAM,eAAA;AAAA,IACN,MAAM;AAAA,GACR;AACF;AAEO,SAAS,eAAA,CAAgB,EAAE,QAAA,EAAS,EAAkC;AAC3E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAU,KAAA,CAAA,QAAA,CAAuB,EAAE,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,CAAA;AACxF,EAAA,MAAM,QAAA,GAAiB,KAAA,C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AAAE,cAAA,KAAA,CAAM,cAAA,EAAe;AAAG,cAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,YAAE;AAAA,UAC7E,CAAA;AAAA,UACA,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAKT,iFAAA;AAAA,YACA,IAAA,IAAQ;AAAA,WACV;AAAA,UAIA,QAAA,EAAA;AAAA,4BAAAD,GAAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAW,EAAA;AAAA,kBACT,iFAAA;AAAA,kBACA,0DAAA;AAAA,kBACA,QAAA,IAAY;AAAA;AACd;AAAA,aACF;AAAA,4BAGAA,GAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yCAAA,EAA0C;AAAA;AAAA;AAAA,OAC5D;AAAA,sBAOAA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,OAAO,EAAE,CAAC,eAAyB,GAAG,CAAA,EAAG,KAAK,CAAA,EAAA,CAAA,EAAK;AAAA,UACnD,SAAA,EAAW,EAAA;AAAA,YACT,8BAAA;AAAA;AAAA;AAAA,YAGA,CAAC,QAAA,IAAY,8EAAA;AAAA,YACb,IAAA,IAAQ,2BAAA;AAAA,YACR,KAAA,IAAS;AAAA,WACX;AAAA,UAEC,QAAA,EAAA;AAAA;AAAA;AACH,KAAA,EACF;AAAA;AAEJ","file":"chunk-RRNMNFLF.js","sourcesContent":["import * as React from 'react'\nimport { Loader2 } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// SaveBar — the single, app-wide \"Unsaved changes\" floating island. A form\n// declares its state via useSaveBar({ dirty, saving, onSave, onDiscard }); the\n// shell renders ONE <SaveBar/> (centered, floating above the content area) that\n// appears whenever the active form is dirty. Mirrors the BackStyleProvider /\n// PageHeaderActions idiom: decide-once at the shell, hook-in at the page.\n//\n// Handlers live in a ref (not state) so per-render closure changes never cause\n// re-render loops; only the primitive `dirty`/`saving` flags drive visibility.\n// ---------------------------------------------------------------------------\n\nexport interface SaveBarRegistration {\n /** Show the bar when true (form has unsaved changes). */\n dirty: boolean\n /**\n * Mantém a barra à vista mesmo sem alteração pendente.\n *\n * Num formulário de CRIAÇÃO ou EDIÇÃO a barra é o caminho de sair — some-la\n * porque nada mudou ainda deixa a tela sem botão de salvar, e quem digitou\n * um valor que por acaso voltou ao original vê a barra piscar. `dirty`\n * continua sendo o que decide a MENSAGEM; isto decide só se ela aparece.\n */\n alwaysVisible?: boolean\n /** Save in progress — disables buttons and shows a spinner. */\n saving?: boolean\n onSave: () => void\n onDiscard?: () => void\n /** Override the \"Unsaved changes\" message. */\n message?: string\n /** Override the Save / Discard button labels. */\n saveLabel?: string\n discardLabel?: string\n}\n\ninterface SaveBarState {\n visible: boolean\n /** A barra está à vista por alteração pendente, ou só por estar num form? */\n dirty?: boolean\n saving: boolean\n message?: string\n saveLabel?: string\n discardLabel?: string\n}\n\ninterface SaveBarApi {\n setState: React.Dispatch<React.SetStateAction<SaveBarState>>\n handlers: React.MutableRefObject<{ onSave?: () => void; onDiscard?: () => void }>\n}\n\n// Two contexts on purpose: the API context is STABLE (so useSaveBar's effect\n// deps don't change every render → no loop), the state context changes to\n// re-render only <SaveBar/>.\nconst SaveBarApiContext = React.createContext<SaveBarApi | null>(null)\nconst SaveBarStateContext = React.createContext<SaveBarState>({ visible: false, saving: false })\n\n// Module-level \"is the SaveBar showing\" signal so sibling UI that isn't a\n// descendant of SaveBarProvider (e.g. the ToastProvider) can react to it —\n// used to lift toasts above the bar so they stack instead of overlapping.\nlet _saveBarVisible = false\nconst _saveBarSubs = new Set<() => void>()\nfunction setSaveBarVisibleSignal(v: boolean) {\n if (v === _saveBarVisible) return\n _saveBarVisible = v\n _saveBarSubs.forEach((fn) => fn())\n}\n\n/** Subscribe to whether the floating SaveBar is currently on screen. */\nexport function useSaveBarVisible(): boolean {\n return React.useSyncExternalStore(\n (cb) => { _saveBarSubs.add(cb); return () => { _saveBarSubs.delete(cb) } },\n () => _saveBarVisible,\n () => false,\n )\n}\n\nexport function SaveBarProvider({ children }: { children: React.ReactNode }) {\n const [state, setState] = React.useState<SaveBarState>({ visible: false, saving: false })\n const handlers = React.useRef<{ onSave?: () => void; onDiscard?: () => void }>({})\n const api = React.useMemo<SaveBarApi>(() => ({ setState, handlers }), [])\n\n // Stack of registered back-navigation handlers (latest-mounted wins) so the\n // app-wide Escape key can navigate \"up\" to the parent route. Lives here, next\n // to the SaveBar handlers, so ONE keydown listener arbitrates both — Escape\n // discards a dirty form first, and only navigates back when none is open.\n const backStack = React.useRef<React.MutableRefObject<(() => void) | undefined>[]>([])\n const backApi = React.useMemo<BackNavApi>(() => ({ stack: backStack }), [])\n\n // Broadcast visibility to the module-level signal (for the ToastProvider).\n React.useEffect(() => { setSaveBarVisibleSignal(state.visible) }, [state.visible])\n\n // App-wide keyboard shortcuts, arbitrated in one place:\n // • Cmd/Ctrl+Enter → save the active (dirty) form\n // • Escape (form dirty) → discard the form\n // • Escape (no dirty form) → navigate back to the parent route\n React.useEffect(() => {\n function onKey(e: KeyboardEvent) {\n if (state.visible && !state.saving) {\n if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {\n e.preventDefault()\n handlers.current.onSave?.()\n } else if (e.key === 'Escape') {\n e.preventDefault()\n handlers.current.onDiscard?.()\n }\n return\n }\n // No open/dirty form — Escape walks \"up\" via the topmost back handler.\n if (e.key === 'Escape' && !e.defaultPrevented && !isEditableTarget(e.target)) {\n for (let i = backStack.current.length - 1; i >= 0; i--) {\n const back = backStack.current[i].current\n if (back) { e.preventDefault(); back(); return }\n }\n }\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [state.visible, state.saving])\n\n return (\n <SaveBarApiContext.Provider value={api}>\n <BackNavApiContext.Provider value={backApi}>\n <SaveBarStateContext.Provider value={state}>\n {children}\n </SaveBarStateContext.Provider>\n </BackNavApiContext.Provider>\n </SaveBarApiContext.Provider>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Back-navigation registry — lets any subpage register its \"go to parent\" action\n// so the shell's single Escape handler can drive it (see SaveBarProvider above).\n// SubpageHeader already receives onBack, so wiring it there gives every plugin\n// detail page Escape-to-parent for free, with zero per-plugin code.\n// ---------------------------------------------------------------------------\n\ninterface BackNavApi {\n stack: React.MutableRefObject<React.MutableRefObject<(() => void) | undefined>[]>\n}\nconst BackNavApiContext = React.createContext<BackNavApi | null>(null)\n\n/** True when the keyboard event originates from a field where Escape has its\n * own meaning (clear/close), so we shouldn't hijack it for back-navigation. */\nfunction isEditableTarget(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null\n if (!el || !el.tagName) return false\n const tag = el.tagName.toLowerCase()\n return tag === 'input' || tag === 'textarea' || tag === 'select' || el.isContentEditable\n}\n\n/**\n * Register a back-navigation handler with the app-wide Escape key. Call it in a\n * subpage (or pass through SubpageHeader's onBack); while mounted, pressing\n * Escape with no dirty form open invokes the most-recently-registered handler.\n * Pass `undefined` to opt out (e.g. a top-level page with nothing to go back to).\n */\nexport function useBackHandler(onBack?: () => void): void {\n const api = React.useContext(BackNavApiContext)\n // Hold the latest closure in a ref so re-renders don't churn the stack.\n const ref = React.useRef(onBack)\n React.useEffect(() => { ref.current = onBack })\n React.useEffect(() => {\n if (!api) return\n const stack = api.stack.current\n stack.push(ref)\n return () => {\n const i = stack.indexOf(ref)\n if (i !== -1) stack.splice(i, 1)\n }\n }, [api])\n}\n\n/**\n * Register the current form with the app-wide SaveBar. Call it unconditionally\n * in a form view; it shows the island while `dirty`, keeps handlers current, and\n * hides the island automatically when the form unmounts (e.g. on navigation).\n */\nexport function useSaveBar({ dirty, alwaysVisible, saving = false, onSave, onDiscard, message, saveLabel, discardLabel }: SaveBarRegistration): void {\n const api = React.useContext(SaveBarApiContext)\n\n // Keep latest handlers in the shared ref (no state churn from new closures).\n React.useEffect(() => {\n if (api) api.handlers.current = { onSave, onDiscard }\n })\n\n // Drive visibility from primitives only; `api` is stable → no render loops.\n React.useEffect(() => {\n if (!api) return\n api.setState({ visible: dirty || !!alwaysVisible, dirty, saving, message, saveLabel, discardLabel })\n return () => api.setState((s) => ({ ...s, visible: false }))\n }, [api, dirty, alwaysVisible, saving, message, saveLabel, discardLabel])\n}\n\n/** The floating island. Rendered once by the shell inside the content column. */\nexport function SaveBar({ className }: { className?: string }) {\n const state = React.useContext(SaveBarStateContext)\n const api = React.useContext(SaveBarApiContext)\n const t = useTranslation()\n\n // Keep the island mounted through its exit animation: `rendered` lags behind\n // `visible` so we can play fade-out before unmounting.\n const [rendered, setRendered] = React.useState(state.visible)\n const [closing, setClosing] = React.useState(false)\n\n React.useEffect(() => {\n if (state.visible) {\n setRendered(true)\n setClosing(false)\n return\n }\n if (!rendered) return\n setClosing(true)\n const id = setTimeout(() => { setRendered(false); setClosing(false) }, 200)\n return () => clearTimeout(id)\n }, [state.visible, rendered])\n\n if (!api || !rendered) return null\n const { saving, message, saveLabel, discardLabel } = state\n\n return (\n <div\n className={cn(\n // Above the tab bar (z-50), below a full-screen sheet (z-60), and lifted\n // clear of the bar's height so its actions are not sitting under it.\n 'pointer-events-none fixed inset-x-0 z-[55] flex justify-center px-4',\n 'bottom-[calc(var(--fz-bottom-bar,0px)+1.25rem)]',\n className,\n )}\n >\n {/* Dark island for strong contrast against the light page (auto-inverts in dark mode). */}\n <div className={cn(\n 'pointer-events-auto flex items-center gap-5 rounded-full bg-foreground py-2 pl-5 pr-2 text-background shadow-xl ring-1 ring-black/5 duration-200',\n closing ? 'animate-out fade-out slide-out-to-bottom-2' : 'animate-in fade-in slide-in-from-bottom-2',\n )}>\n <span className=\"flex items-center gap-2 text-sm font-medium\">\n <span className=\"h-2 w-2 shrink-0 rounded-full bg-amber-400\" />\n {message ?? t('saveBar.unsaved')}\n </span>\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n data-tour=\"savebar.discard\"\n disabled={saving}\n onClick={() => api.handlers.current.onDiscard?.()}\n className=\"rounded-full px-3 py-1.5 text-sm font-medium text-background/70 transition-colors hover:bg-background/10 hover:text-background disabled:opacity-50\"\n >\n {discardLabel ?? t('common.discard')}\n </button>\n <button\n type=\"button\"\n data-tour=\"savebar.save\"\n disabled={saving}\n onClick={() => api.handlers.current.onSave?.()}\n className=\"inline-flex items-center rounded-full bg-background px-4 py-1.5 text-sm font-semibold text-foreground transition-colors hover:bg-background/90 disabled:opacity-60\"\n >\n {saving && <Loader2 className=\"mr-1.5 h-3.5 w-3.5 animate-spin\" />}\n {saveLabel ?? t('common.save')}\n </button>\n </div>\n </div>\n </div>\n )\n}\n","import * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { create } from 'zustand'\n\ninterface PageHeaderState {\n /**\n * Where a page's own header DRAWS, so it can stay in the tree that wrote it.\n *\n * This used to be the node itself, handed over through this store — and a\n * store is not a React tree. The shell rendered it under ITS providers, so a\n * title carrying anything plugin-shaped (a quote's status dropdown) threw\n * \"useStore must be used within CrmPage\" and took the page with it. Same\n * lesson the right rail already learned: the page stays where it was written\n * and portals its body in.\n */\n shellSlot: HTMLElement | null\n setShellSlot: (element: HTMLElement | null) => void\n /** A container deeper than the shell — a module's own content column — that is\n * better placed to draw the header. It wins while it is mounted. */\n outletSlot: HTMLElement | null\n setOutletSlot: (element: HTMLElement | null) => void\n /** A page is drawing its own header, so the shell must not draw one too. */\n claimed: boolean\n /** Identity of whoever owns the slot, so a late unmount can't clear a newer\n * owner's content — the exact race you get navigating form → form. */\n owner: string | null\n /** The claimed header carries a back action, i.e. what the bar is showing is\n * a SUBPAGE (\"← Contas a Pagar / Nova\"), not the module's own screen. The\n * module's tab band reads this to step aside: a form reached from a tab is\n * not one of the tabs, and leaving the strip up marks a place the user is no\n * longer at, one line under a back link that says so. */\n hasBack: boolean\n /** How many shells are currently rendering the slot. A page needs to know:\n * with no host (minimal layout, an embedded form, a modal) its header would\n * be claimed into the void, and the page must draw it inline instead. */\n hosts: number\n /**\n * Quantos OUTLETS internos estão mostrando o slot. Um outlet é um container\n * mais fundo que a shell — a coluna de conteúdo de um módulo com trilha\n * lateral — que fica em melhor posição para desenhar o cabeçalho.\n *\n * Quando existe um, a barra da shell se cala: as duas juntas desenhariam a\n * mesma migalha duas vezes, e a da shell atravessa a largura inteira,\n * empurrando a trilha do módulo para baixo do topo.\n */\n outlets: number\n /**\n * Quantos blocos de ações de página estão montados agora. A barra precisa\n * saber ANTES de decidir se existe: ela some no celular de alguns produtos, e\n * um \"Novo\" entregue a uma barra escondida simplesmente não aparecia.\n */\n actions: number\n claim: (owner: string, hasBack?: boolean) => void\n release: (owner: string) => void\n addHost: () => void\n removeHost: () => void\n addOutlet: () => void\n removeOutlet: () => void\n addActions: () => void\n removeActions: () => void\n}\n\nconst usePageHeaderStore = create<PageHeaderState>((set, get) => ({\n shellSlot: null,\n setShellSlot: (element) => set({ shellSlot: element }),\n outletSlot: null,\n setOutletSlot: (element) => set({ outletSlot: element }),\n claimed: false,\n owner: null,\n hasBack: false,\n hosts: 0,\n outlets: 0,\n actions: 0,\n claim: (owner, hasBack = false) => set({ owner, claimed: true, hasBack }),\n release: (owner) => {\n if (get().owner === owner) set({ owner: null, claimed: false, hasBack: false })\n },\n addHost: () => set((s) => ({ hosts: s.hosts + 1 })),\n removeHost: () => set((s) => ({ hosts: Math.max(0, s.hosts - 1) })),\n addOutlet: () => set((s) => ({ outlets: s.outlets + 1 })),\n removeOutlet: () => set((s) => ({ outlets: Math.max(0, s.outlets - 1) })),\n addActions: () => set((s) => ({ actions: s.actions + 1 })),\n removeActions: () => set((s) => ({ actions: Math.max(0, s.actions - 1) })),\n}))\n\n/** Declara que esta página tem ações no topo. Chamado por PageHeaderActions. */\nexport function useRegisterPageActions(): void {\n const add = usePageHeaderStore((s) => s.addActions)\n const remove = usePageHeaderStore((s) => s.removeActions)\n React.useEffect(() => {\n add()\n return remove\n }, [add, remove])\n}\n\n/** Se alguma página tem ações no topo agora. A barra usa para não sumir com\n * elas no celular, e para não existir vazia. */\nexport function useHasPageActions(): boolean {\n return usePageHeaderStore((s) => s.actions > 0)\n}\n\n/** Read the current override. The shell calls this; pages should not. */\n/** True while a page is drawing its own header into the bar's slot. */\nexport function usePageHeaderClaimed(): boolean {\n return usePageHeaderStore((s) => s.claimed)\n}\n\n/** The bar's portal target, for the page that draws into it. */\nexport function usePageTitleSlot(): HTMLElement | null {\n return usePageHeaderStore((s) => s.outletSlot ?? s.shellSlot)\n}\n\n/** Registers the bar's portal target. Called by the shell. */\nexport function usePageTitleSlotHost(): (element: HTMLElement | null) => void {\n return usePageHeaderStore((s) => s.setShellSlot)\n}\n\n/**\n * Declare that this shell renders the page-header slot. Called by the layout,\n * never by a page. Without it `PageHeader` cannot tell \"nobody claimed the bar\"\n * from \"there is no bar\", and a header would vanish instead of falling back.\n */\nexport function usePageHeaderHost(): void {\n const addHost = usePageHeaderStore((s) => s.addHost)\n const removeHost = usePageHeaderStore((s) => s.removeHost)\n React.useEffect(() => {\n addHost()\n return removeHost\n }, [addHost, removeHost])\n}\n\n/** Whether any shell OR inner outlet is showing the slot right now. */\nexport function useHasPageHeaderHost(): boolean {\n return usePageHeaderStore((s) => s.hosts > 0 || s.outlets > 0)\n}\n\n/** True when a deeper container took over drawing the header. The shell bar\n * uses this to stand down. */\nexport function useHasPageHeaderOutlet(): boolean {\n return usePageHeaderStore((s) => s.outlets > 0)\n}\n\n/**\n * Desenha o cabeçalho AQUI em vez de na barra da shell.\n *\n * Para quem tem uma coluna própria de conteúdo — um módulo com trilha lateral —,\n * onde a barra da shell, larga demais, passaria por cima da trilha.\n */\nexport function PageHeaderOutlet({ className }: { className?: string }): React.ReactElement | null {\n const setOutletSlot = usePageHeaderStore((s) => s.setOutletSlot)\n const claimed = usePageHeaderStore((s) => s.claimed)\n const addOutlet = usePageHeaderStore((s) => s.addOutlet)\n const removeOutlet = usePageHeaderStore((s) => s.removeOutlet)\n\n React.useEffect(() => {\n addOutlet()\n return removeOutlet\n }, [addOutlet, removeOutlet])\n\n // A target, not a renderer: the page portals its own header in here, keeping\n // the tree that wrote it. `empty:hidden` keeps the margin off an unused slot.\n return React.createElement('div', {\n ref: setOutletSlot,\n className: `${className ?? 'mb-4'}${claimed ? '' : ' hidden'}`,\n })\n}\n\n/**\n * Put this page's own header — a back link, a breadcrumb — into the shell's top\n * bar, replacing the page title for as long as the page is mounted.\n *\n * Prefer the `PageHeader` component: it is this hook plus the one agreed layout\n * (← + title), so every screen in every app reads the same. Reach for the hook\n * directly only for a header that genuinely is not \"back + title\".\n *\n * A form or detail screen already says where it is (\"← Novo produto\") and the\n * bar above it was saying \"Produtos\" again, one line up. Two headers stacked is\n * a whole row of vertical space spent repeating a word.\n *\n * The node is re-claimed on every change so a breadcrumb whose label depends on\n * loaded data (a record's name) updates once it arrives.\n */\n/**\n * Tells the bar that this page is drawing its own header, and whether that\n * header carries a back action. The header ITSELF goes through `PageTitlePortal`\n * — flags travel as data, JSX stays in the tree that wrote it.\n */\nexport function usePageHeader(active: boolean, options?: { back?: boolean }): void {\n const id = React.useId()\n const claim = usePageHeaderStore((s) => s.claim)\n const release = usePageHeaderStore((s) => s.release)\n const back = options?.back ?? false\n\n React.useEffect(() => {\n if (!active) { release(id); return }\n claim(id, back)\n return () => release(id)\n }, [id, active, back, claim, release])\n}\n\n/** True while the bar is showing a subpage's \"← parent / title\". See\n * `PageHeaderState.hasBack`. */\nexport function useHasPageHeaderBack(): boolean {\n return usePageHeaderStore((s) => s.hasBack)\n}\n\nexport { usePageHeaderStore }\n\n/**\n * Draws a page's own header into the bar WITHOUT leaving its React tree, so a\n * title made of plugin components still has its plugin's providers above it.\n * With nowhere to draw into it renders where it stands, as any fallback.\n */\nexport function PageTitlePortal({ children }: { children: React.ReactNode }): React.ReactElement | null {\n const slot = usePageTitleSlot()\n if (!slot) return React.createElement(React.Fragment, null, children)\n return createPortal(children, slot)\n}\n","import { useNavReferrer, navHistoryBack, routeModule } from '@fayz-ai/core'\n\n/**\n * Context-aware back target shared by all header/breadcrumb components.\n *\n * When the user arrived from a *different* module (tracked in the global\n * navigation history), a page's own onBack/parentLabel point at its local\n * parent — wrong for the referrer. In that case we return the referrer's label\n * and a back action that pops the browser history to the actual previous page.\n * Within the same module the page's own (more specific) values pass through\n * unchanged, so existing behavior is preserved.\n */\nexport function useCrossModuleBack(onBack?: () => void, parentLabel?: string): {\n onBack?: () => void\n parentLabel?: string\n isCrossModule: boolean\n} {\n const currentPath = typeof window !== 'undefined'\n ? ((window.location.hash ? window.location.hash.slice(1) : window.location.pathname) || '/')\n : '/'\n const referrer = useNavReferrer(currentPath)\n const cross = referrer && referrer.label && routeModule(referrer.path) !== routeModule(currentPath)\n ? referrer\n : null\n return {\n onBack: cross ? () => navHistoryBack(onBack) : onBack,\n parentLabel: cross ? cross.label : parentLabel,\n isCrossModule: !!cross,\n }\n}\n","import * as React from 'react'\nimport { ArrowLeft } from 'lucide-react'\nimport { usePageHeader, useHasPageHeaderHost, PageTitlePortal } from '../stores/page-header.store'\nimport { useBackHandler } from '../layout/SaveBar'\nimport { useCrossModuleBack } from '../layout/useCrossModuleBack'\n\n// ---------------------------------------------------------------------------\n// PageHeader — the header of ANY inner page, in one place.\n//\n// ← Orders / Order #1138 in the shell bar\n// ──────────────────────────\n// content, without repeating the title\n//\n// In the bar and not in the body because the bar exists anyway and already owns\n// the height: a header in the body spends a whole extra row saying what the bar\n// says for free — which is how screens ended up titled twice, \"Financial\" in the\n// bar and \"Payables\" right below it.\n//\n// With no bar (minimal layout, embedded form, modal) it draws inline, otherwise\n// the header would simply vanish.\n// ---------------------------------------------------------------------------\n\n/**\n * The header's markup, hook-free, so the shell can draw the SAME thing when the\n * title comes from the route instead of the page. Two copies of this markup is\n * how the app grew two different back arrows.\n */\nexport function PageHeaderCrumb({\n title,\n parentLabel,\n onBack,\n headingLevel = 'h2',\n}: {\n title?: React.ReactNode\n parentLabel?: string\n onBack?: () => void\n /** The shell passes 'h1': its page title IS the page's top-level heading, and\n * most screens render no other one, so h2 there is a skipped level. */\n headingLevel?: 'h1' | 'h2'\n}) {\n // `title` is a ReactNode, and screens do pass one — a status dropdown, a\n // chip. A heading must hold TEXT: wrapping an interactive node in an <h1>\n // nests a button inside a heading, which is both invalid and a lie to a\n // screen reader. Only a string becomes the heading; a node stays a span.\n const Heading = headingLevel\n const asHeading = typeof title === 'string' && title !== ''\n\n // No back path means a top-level page: just the title, at title size. No\n // point demoting it to a breadcrumb.\n if (!onBack) {\n if (!title) return null\n return asHeading\n ? <Heading className=\"min-w-0 truncate text-lg font-semibold\">{title}</Heading>\n : <span className=\"min-w-0 truncate text-lg font-semibold\">{title}</span>\n }\n\n return (\n <nav className=\"flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground\">\n <button\n type=\"button\"\n onClick={onBack}\n className=\"inline-flex shrink-0 items-center gap-1 transition-colors hover:text-foreground\"\n >\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {parentLabel ?? 'Voltar'}\n </button>\n {title != null && (\n <>\n <span className=\"shrink-0\">/</span>\n {title === '' ? (\n // Title still waiting on data: a pulsing bar, otherwise the line\n // appears from nowhere and shoves the rest when the record lands.\n <span className=\"inline-block h-4 w-24 animate-pulse rounded bg-muted align-middle\" />\n ) : asHeading ? (\n // A heading, not a span, when it IS the screen's name: a subpage\n // that only ever renders a breadcrumb was leaving the page with no\n // heading for a screen reader to land on.\n <Heading className=\"min-w-0 truncate font-medium text-foreground\">{title}</Heading>\n ) : (\n <span className=\"min-w-0 truncate font-medium text-foreground\">{title}</span>\n )}\n </>\n )}\n </nav>\n )\n}\n\nexport interface PageHeaderProps {\n /** What THIS page is. Empty while loading → pulsing placeholder. */\n title: React.ReactNode\n /** Where the arrow goes back to. Without it there is no crumb, just the title. */\n onBack?: () => void\n /** Name of the arrow's destination (\"Orders\"), written before the slash. */\n parentLabel?: string\n /** Link text when there is no `parentLabel`. */\n backLabel?: string\n}\n\nexport function PageHeader({ title, onBack, parentLabel, backLabel }: PageHeaderProps) {\n const hasHost = useHasPageHeaderHost()\n\n // Arriving from another module goes back where you came from, not to this\n // screen's theoretical parent.\n const { onBack: effectiveOnBack, parentLabel: effectiveParent } = useCrossModuleBack(onBack, parentLabel)\n // The same action becomes the app's Escape, with no per-plugin code.\n useBackHandler(effectiveOnBack)\n\n const node = React.useMemo(() => (\n <PageHeaderCrumb\n title={title}\n parentLabel={effectiveParent ?? backLabel}\n onBack={effectiveOnBack}\n />\n ), [effectiveOnBack, effectiveParent, backLabel, title])\n\n // The claim is unconditional (hook order cannot change); what varies is\n // whether ANYONE is showing the bar.\n usePageHeader(hasHost, { back: !!effectiveOnBack })\n\n // Portalled, not handed over: the node keeps whatever providers wrote it.\n if (hasHost) return <PageTitlePortal>{node}</PageTitlePortal>\n return <div className=\"mb-4\">{node}</div>\n}\n","import { create } from 'zustand'\n\ninterface LayoutState {\n sidebarOpen: boolean\n sidebarCollapsed: boolean\n mobileDrawerOpen: boolean\n /**\n * A próxima troca de rota NÃO fecha a gaveta.\n *\n * \"Voltar para o início\" navega, mas o que ele faz é trocar o TRILHO: a\n * pessoa segue escolhendo para onde ir, dentro do menu. Fechar ali devolvia\n * a tela de onde ela estava saindo e obrigava a reabrir o menu para o passo\n * seguinte. Consumido uma vez e rearmado em false, para que um destino de\n * verdade continue fechando.\n */\n drawerKeepOpenOnce: boolean\n commandPaletteOpen: boolean\n /**\n * O que a paleta já deve estar procurando quando abrir.\n *\n * A busca do trilho filtra o trilho; quando o que se procura não está lá,\n * ela ESCALA para a paleta — e escalar não pode custar digitar de novo o\n * que já foi digitado. Zerado ao fechar, para que o ⌘K seco abra limpo.\n */\n commandPaletteQuery: string\n setMobileDrawerOpen: (open: boolean) => void\n keepDrawerOpenOnce: () => void\n toggleSidebar: () => void\n setSidebarCollapsed: (collapsed: boolean) => void\n toggleMobileDrawer: () => void\n setCommandPaletteOpen: (open: boolean, query?: string) => void\n}\n\nexport const useLayoutStore = create<LayoutState>((set) => ({\n sidebarOpen: true,\n sidebarCollapsed: false,\n mobileDrawerOpen: false,\n drawerKeepOpenOnce: false,\n commandPaletteOpen: false,\n commandPaletteQuery: '',\n\n toggleSidebar: () =>\n set((state) => ({ sidebarOpen: !state.sidebarOpen })),\n\n setSidebarCollapsed: (collapsed) =>\n set({ sidebarCollapsed: collapsed }),\n\n toggleMobileDrawer: () =>\n set((state) => ({ mobileDrawerOpen: !state.mobileDrawerOpen })),\n\n setMobileDrawerOpen: (open) => set({ mobileDrawerOpen: open }),\n keepDrawerOpenOnce: () => set({ drawerKeepOpenOnce: true }),\n\n // Opening search closes the mobile drawer. The palette is a full-screen\n // surface on a phone, and leaving the drawer mounted behind it means the user\n // dismisses the palette onto a menu they had already navigated away from.\n // Handled here so every entry point behaves the same — the rail's search\n // field, the topbar button and the ⌘K shortcut.\n setCommandPaletteOpen: (open, query) =>\n set(open\n ? { commandPaletteOpen: true, mobileDrawerOpen: false, commandPaletteQuery: query ?? '' }\n : { commandPaletteOpen: false, commandPaletteQuery: '' }),\n}))\n","import * as React from 'react'\nimport { CornerDownLeft, Search } from 'lucide-react'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { cn } from '../lib/cn'\n\n/** \"⌘\" on a Mac, \"Ctrl \" everywhere else — the hint has to name the key the\n * reader actually has, or it is decoration. */\nexport function shortcutKey(): string {\n if (typeof navigator === 'undefined') return '⌘'\n return /Mac|iPhone|iPad/u.test(navigator.platform || navigator.userAgent) ? '⌘' : 'Ctrl '\n}\n\n/**\n * A única busca da casca, centrada na barra da página.\n *\n * Ela era uma linha da trilha. A trilha é onde se TROCA de tela, e buscar não é\n * um destino — é a travessia de todas elas, então pertence à faixa que fica\n * parada enquanto a seleção da trilha anda. Centrada e não encostada numa\n * ponta: no meio da barra ela fica equidistante de onde quer que o cursor\n * esteja, e lê como porta de entrada do produto em vez de mais um controle\n * enfileirado ao lado do título.\n *\n * Botão, não campo, no modo padrão: quem digita digita na paleta, e um input\n * que rouba o cursor no clique brigaria com ⌘K pelo mesmo trabalho. O modo\n * CONTEXTUAL (`onValueChange`) é a exceção — ali ele filtra o que a trilha já\n * está mostrando, e não há paleta para disputar.\n */\nexport interface ShellSearchProps {\n /** Placeholder. In a context the host names WHAT is being filtered here —\n * \"Buscar relatórios\", \"Buscar em Configurações\". */\n label?: string\n /** `rail` paints it with the sidebar tokens; on a dark rail the page tokens\n * would be dark text on dark. */\n tone?: 'bar' | 'rail'\n /** Collapsed rail: the magnifier alone, and it goes straight to the palette —\n * there is no room to type, so there is nothing to filter. */\n collapsed?: boolean\n /** Contextual mode. With a handler the control is a FIELD that filters what\n * the rail is showing; without one it stays a button onto the palette. */\n value?: string\n onValueChange?: (value: string) => void\n /** The way out to the whole product, shown once something is typed. */\n searchAllLabel?: string\n className?: string\n}\n\n/** The one search affordance of the shell — first field of the rail, under the\n * workspace picker and whatever switch the host hung below it.\n *\n * It searches WHERE YOU ARE first. In a context (Settings, a module that took\n * the rail) that is the list in front of you; on the app rail it is the app's\n * own destinations. That is the answer to the question people actually ask\n * from a screen — \"where is the report I was just in\" — and the reason it is a\n * field and not a button: the palette is a different act, over everything the\n * tenant owns, and jumping straight to it turned every local look-up into a\n * global one.\n *\n * The global search is never more than one keystroke away: Enter escalates and\n * CARRIES the typed text into the palette, and the row under the field says so\n * in words as soon as there is something to carry. ⌘K still opens it cold. */\nexport function ShellSearch({\n label = 'Search',\n tone = 'bar',\n collapsed = false,\n value,\n onValueChange,\n searchAllLabel = 'Search everywhere',\n className,\n}: ShellSearchProps) {\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n const rail = tone === 'rail'\n const contextual = !!onValueChange && !collapsed\n const query = value ?? ''\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n const escalate = () => setCommandPaletteOpen(true, query)\n\n const surface = rail\n ? 'bg-sidebar-accent/40 text-sidebar-muted hover:bg-sidebar-accent/70 hover:text-sidebar-foreground'\n : 'bg-accent/40 text-muted-foreground hover:bg-accent/70 hover:text-foreground'\n // Foco discreto: num trilho escuro `sidebar-accent-foreground` é quase\n // branco, e um anel de 2px nessa cor desenhava uma caixa acesa em volta do\n // campo — mais forte que o item selecionado do próprio menu. Um anel fino e\n // a superfície um tom acima já dizem \"o cursor está aqui\".\n const ring = rail\n ? 'focus-within:bg-sidebar-accent/70 focus-within:ring-1 focus-within:ring-sidebar-accent-foreground/25'\n : 'focus-within:bg-accent/70 focus-within:ring-1 focus-within:ring-ring/40'\n\n if (!contextual) {\n return (\n <button\n onClick={escalate}\n aria-keyshortcuts=\"Meta+K Control+K\"\n className={cn(\n // Tonal surface, no outline. A 1px border here is a hard edge\n // competing with every other hard edge; a lighter fill of the same\n // hue reads as \"a field\" without drawing a box — and leaves the\n // outline treatment free to mean focus, which it must.\n 'fz-tap group flex items-center rounded-lg transition-colors',\n collapsed ? 'h-9 w-9 justify-center' : 'h-9 w-full gap-2.5 px-2.5',\n surface,\n 'focus-visible:outline-none focus-visible:ring-2',\n rail ? 'focus-visible:ring-sidebar-accent-foreground/50' : 'focus-visible:ring-ring/50',\n className,\n )}\n aria-label={label}\n title={collapsed ? label : undefined}\n >\n <Search className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left text-[13px]\">{label}</span>\n {/* The shortcut is a hint, not a control: no chip, no border, and\n it steps aside on hover rather than sitting there as chrome. */}\n <span className=\"shrink-0 text-[11px] font-medium tabular-nums opacity-70 transition-opacity group-hover:opacity-100\">\n {shortcutKey()}K\n </span>\n </>\n )}\n </button>\n )\n }\n\n return (\n <div className={cn('flex flex-col gap-1', className)}>\n <div\n className={cn(\n 'group flex h-9 w-full items-center gap-2.5 rounded-lg px-2.5 transition-colors',\n surface,\n 'focus-within:outline-none',\n ring,\n )}\n >\n <Search className=\"h-4 w-4 shrink-0\" />\n <input\n ref={inputRef}\n type=\"search\"\n value={query}\n onChange={(e) => onValueChange!(e.target.value)}\n onKeyDown={(e) => {\n // Enter is the escalation: what is typed here goes on being typed\n // over there. Escape empties the filter first and only gives the\n // rail back on a second press — leaving a rail filtered down to\n // three rows with no visible cause is how a menu looks broken.\n if (e.key === 'Enter') { e.preventDefault(); escalate() }\n if (e.key === 'Escape' && query) { e.preventDefault(); onValueChange!('') }\n }}\n placeholder={label}\n aria-label={label}\n aria-keyshortcuts=\"Meta+K Control+K\"\n className={cn(\n 'min-w-0 flex-1 border-none bg-transparent p-0 text-[13px] outline-none',\n // `search` inputs paint their own clear button in WebKit, on top of\n // ours and in the browser's grey.\n '[&::-webkit-search-cancel-button]:appearance-none',\n rail\n ? 'text-sidebar-foreground placeholder:text-sidebar-muted'\n : 'text-foreground placeholder:text-muted-foreground',\n )}\n />\n {/* O atalho enquanto o campo está vazio: ali ele cabe e é a única coisa\n que a linha tem a dizer. Digitou, ele sai — a partir daí quem\n anuncia a busca global é a linha de baixo, e um ⌘K ao lado de um\n filtro local prometeria que este campo É a paleta. */}\n {!query && (\n <span className=\"shrink-0 text-[11px] font-medium tabular-nums opacity-70 transition-opacity group-hover:opacity-100\">\n {shortcutKey()}K\n </span>\n )}\n </div>\n\n {/* A saída para o produto inteiro, dita em palavras assim que há o que\n levar. Sem ela, filtrar o trilho e não achar nada é um beco: a pessoa\n apaga o que digitou e recomeça em outro lugar, quando a resposta\n estava a um Enter.\n Sem lupa própria: o ícone já está no campo logo acima, e repeti-lo\n fazia a linha ler como um SEGUNDO campo de busca. Ela se alinha ao\n texto digitado (mesma sangria de 36px) porque é a continuação daquela\n frase, não um controle novo. */}\n {query && (\n <button\n onClick={escalate}\n className={cn(\n 'fz-tap flex w-full items-center gap-2 rounded-lg py-1.5 pl-9 pr-2.5 text-left text-[12px] transition-colors',\n rail\n ? 'text-sidebar-muted hover:bg-sidebar-accent/50 hover:text-sidebar-foreground'\n : 'text-muted-foreground hover:bg-accent/60 hover:text-foreground',\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{searchAllLabel}</span>\n <CornerDownLeft className=\"h-3.5 w-3.5 shrink-0 opacity-60\" aria-hidden />\n </button>\n )}\n </div>\n )\n}\n","import * as React from 'react'\nimport { ChevronRight, Crown, ExternalLink, type LucideIcon } from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// Rail flyout — what the collapsed sidebar says when you point at it.\n//\n// One panel for the WHOLE rail, not one tooltip per row: it slides down the\n// rail to whichever item the pointer is on and swaps its contents on arrival,\n// so running down the menu reads as a single object following you instead of a\n// dozen bubbles blinking in and out. It also carries the item's children, which\n// a tooltip could not — a collapsed rail otherwise hides every sub-link behind\n// a click.\n//\n// The panel is painted in the SIDEBAR's tone (not the popover's): it is the\n// menu speaking, and a white card on a dark rail read as a foreign surface.\n// ---------------------------------------------------------------------------\n\nexport interface RailFlyoutEntry {\n id: string\n label: string\n icon?: string\n route?: string\n href?: string\n premium?: boolean\n badge?: string | number\n}\n\nexport interface RailFlyoutContent {\n /** Identity of the anchored item — a change is what triggers the swap. */\n key: string\n label: string\n route?: string\n href?: string\n premium?: boolean\n badge?: string | number\n entries?: RailFlyoutEntry[]\n}\n\nexport interface RailFlyoutHandle {\n /** Props to spread on a collapsed row so it anchors the panel. */\n rowProps: (content: RailFlyoutContent) => {\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => void\n onFocus: (event: React.FocusEvent<HTMLElement>) => void\n onMouseLeave: () => void\n }\n /** Rendered by the rail, as a sibling of its scrolling nav. */\n panel: React.ReactNode\n /** Close now (navigation, Escape, focus leaving the rail). */\n dismiss: () => void\n}\n\n/** Gap between the rail's edge and the panel — also the pointer's bridge, so\n * moving diagonally from the icon into the panel never crosses dead space. */\nconst GUTTER_PX = 8\nconst CLOSE_DELAY_MS = 140\n\n/** Layout effect on the client, plain effect during SSR (avoids the warning). */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction iconOf(name?: string): LucideIcon | null {\n if (!name) return null\n return ICON_MAP[name] ?? null\n}\n\n// ---------------------------------------------------------------------------\n// Quem mais mora na trilha\n//\n// O painel é um só para o rail inteiro, e por isso o handle precisa alcançar\n// mais do que os links: um widget montado no pé da trilha (tarefas, um\n// interruptor de serviço) esconde o rótulo quando ela recolhe, e sem nada a\n// dizer no hover vira um ícone anônimo — enquanto o link ao lado abre um painel\n// com nome e filhos. O contexto entrega o MESMO painel a essas linhas.\n// ---------------------------------------------------------------------------\n\nconst RailFlyoutContext = React.createContext<RailFlyoutHandle | null>(null)\n\nexport const RailFlyoutProvider = RailFlyoutContext.Provider\n\n/**\n * Props de hover para uma linha da trilha que não é um link de navegação.\n * Espalhe no botão; fora de uma trilha (ou com ela aberta) não faz nada.\n */\nexport function useRailRow(content: RailFlyoutContent | null): {\n onMouseEnter?: (event: React.MouseEvent<HTMLElement>) => void\n onFocus?: (event: React.FocusEvent<HTMLElement>) => void\n onMouseLeave?: () => void\n} {\n const flyout = React.useContext(RailFlyoutContext)\n if (!flyout || !content) return {}\n return flyout.rowProps(content)\n}\n\nexport function useRailFlyout({\n enabled,\n railRef,\n activeRoute,\n onNavigate,\n}: {\n enabled: boolean\n railRef: React.RefObject<HTMLElement | null>\n activeRoute?: string | null\n onNavigate: (route: string) => void\n}): RailFlyoutHandle {\n const [state, setState] = React.useState<{ anchor: HTMLElement; content: RailFlyoutContent } | null>(null)\n const [pos, setPos] = React.useState({ top: 0, arrow: 20 })\n // Transitions are off while the panel is hidden: the first appearance would\n // otherwise fly in from wherever the previous item left it.\n const [animate, setAnimate] = React.useState(false)\n const panelRef = React.useRef<HTMLDivElement>(null)\n const closeTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n // Held so the panel can fade OUT still showing what it was showing.\n const lastContent = React.useRef<RailFlyoutContent | null>(null)\n\n const cancelClose = React.useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const show = React.useCallback(\n (anchor: HTMLElement, content: RailFlyoutContent) => {\n if (!enabled) return\n cancelClose()\n setState({ anchor, content })\n },\n [enabled, cancelClose],\n )\n\n const hide = React.useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setState(null), CLOSE_DELAY_MS)\n }, [cancelClose])\n\n const dismiss = React.useCallback(() => {\n cancelClose()\n setState(null)\n }, [cancelClose])\n\n React.useEffect(() => () => cancelClose(), [cancelClose])\n\n // Anything that isn't the rail anymore closes it: leaving the enabled state\n // (rail expanded) would otherwise strand an open panel over the content.\n React.useEffect(() => {\n if (!enabled) dismiss()\n }, [enabled, dismiss])\n\n // Position: aligned with the row, clamped so a long child list can't hang off\n // the top or bottom of the rail. The arrow keeps pointing at the row even\n // after the clamp moved the panel away from it.\n const reposition = React.useCallback(() => {\n const rail = railRef.current\n const anchor = state?.anchor\n if (!rail || !anchor) return\n const railRect = rail.getBoundingClientRect()\n const rect = anchor.getBoundingClientRect()\n const height = panelRef.current?.offsetHeight ?? 0\n const rowTop = rect.top - railRect.top\n const rowCenter = rowTop + rect.height / 2\n const max = Math.max(GUTTER_PX, railRect.height - height - GUTTER_PX)\n const top = Math.min(Math.max(GUTTER_PX, rowTop - 6), max)\n const arrow = Math.min(Math.max(rowCenter - top, 14), Math.max(14, height - 14))\n setPos({ top, arrow })\n }, [railRef, state])\n\n useIsomorphicLayoutEffect(reposition, [reposition, state?.content.key])\n\n // The rail scrolls under the panel: without this the panel stays pinned where\n // the row USED to be, which is the one thing a follower must never do.\n React.useEffect(() => {\n if (!state) return\n const rail = railRef.current\n const onScroll = () => reposition()\n rail?.addEventListener('scroll', onScroll, true)\n window.addEventListener('resize', onScroll)\n return () => {\n rail?.removeEventListener('scroll', onScroll, true)\n window.removeEventListener('resize', onScroll)\n }\n }, [state, railRef, reposition])\n\n const visible = !!state\n React.useEffect(() => {\n if (!visible) {\n setAnimate(false)\n return\n }\n const id = requestAnimationFrame(() => setAnimate(true))\n return () => cancelAnimationFrame(id)\n }, [visible])\n\n React.useEffect(() => {\n if (!visible) return\n const onKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') dismiss()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [visible, dismiss])\n\n const rowProps = React.useCallback(\n (content: RailFlyoutContent) => ({\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => show(event.currentTarget, content),\n onFocus: (event: React.FocusEvent<HTMLElement>) => show(event.currentTarget, content),\n onMouseLeave: hide,\n }),\n [show, hide],\n )\n\n if (state) lastContent.current = state.content\n const content = state?.content ?? lastContent.current\n\n const go = (entry: { route?: string; href?: string }) => {\n dismiss()\n if (entry.href) {\n window.open(entry.href, '_blank', 'noopener,noreferrer')\n return\n }\n if (entry.route) onNavigate(entry.route)\n }\n\n const entries = content?.entries ?? []\n const hasEntries = entries.length > 0\n\n const panel = enabled ? (\n <div\n // Outside the scrolling nav on purpose: inside it, the panel would be\n // clipped at the rail's 4rem edge and scroll away from its own anchor.\n style={{ transform: `translateY(${pos.top}px)`, paddingLeft: GUTTER_PX }}\n onMouseEnter={cancelClose}\n onMouseLeave={hide}\n className={cn(\n 'absolute left-full top-0 z-50 hidden md:block',\n animate && 'motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-out',\n visible ? 'opacity-100' : 'pointer-events-none opacity-0',\n )}\n aria-hidden={!visible}\n >\n <div\n ref={panelRef}\n className={cn(\n // Sidebar tone, sidebar border: the panel is the menu leaning out,\n // not a popover from the page underneath it.\n 'relative rounded-lg border border-sidebar-border bg-sidebar p-1 text-sidebar-foreground shadow-xl shadow-black/25',\n hasEntries ? 'min-w-[12.5rem] max-w-[16rem]' : 'max-w-[15rem]',\n )}\n >\n {/* Notch — a rotated square sharing the panel's fill and border, with\n the two inner edges masked by the panel itself. */}\n <span\n aria-hidden\n style={{ top: pos.arrow }}\n className=\"absolute -left-[5px] h-2.5 w-2.5 -translate-y-1/2 rotate-45 border-b border-l border-sidebar-border bg-sidebar\"\n />\n <div key={content?.key} className=\"saas-flyout-swap\">\n {content && <FlyoutBody content={content} entries={entries} activeRoute={activeRoute} onGo={go} />}\n </div>\n </div>\n </div>\n ) : null\n\n return { rowProps, panel, dismiss }\n}\n\nfunction FlyoutBody({\n content,\n entries,\n activeRoute,\n onGo,\n}: {\n content: RailFlyoutContent\n entries: RailFlyoutEntry[]\n activeRoute?: string | null\n onGo: (entry: { route?: string; href?: string }) => void\n}) {\n const hasEntries = entries.length > 0\n const headerActive = !!content.route && content.route === activeRoute\n const headerClickable = !!content.route || !!content.href\n\n const header = (\n <div\n className={cn(\n 'flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-semibold',\n hasEntries ? 'text-sidebar-foreground' : 'whitespace-nowrap',\n headerActive && 'text-sidebar-accent-foreground',\n headerClickable && 'transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{content.label}</span>\n {content.href && <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />}\n {content.premium && <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />}\n {content.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {content.badge}\n </span>\n )}\n {hasEntries && headerClickable && (\n <ChevronRight className=\"h-3 w-3 shrink-0 text-sidebar-muted\" aria-hidden />\n )}\n </div>\n )\n\n return (\n <>\n {headerClickable ? (\n <button type=\"button\" onClick={() => onGo(content)} className=\"w-full text-left\">\n {header}\n </button>\n ) : (\n header\n )}\n {hasEntries && (\n <>\n <div className=\"my-1 h-px bg-sidebar-border\" />\n <div className=\"flex flex-col\">\n {entries.map((entry) => {\n const EntryIcon = iconOf(entry.icon)\n const isActive = !!entry.route && entry.route === activeRoute\n return (\n <button\n key={entry.id}\n type=\"button\"\n onClick={() => onGo(entry)}\n className={cn(\n 'flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] transition-colors',\n isActive\n ? 'bg-sidebar-accent font-medium text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/75 hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n )}\n >\n {EntryIcon && <EntryIcon className=\"h-3.5 w-3.5 shrink-0 opacity-70\" />}\n <span className=\"min-w-0 flex-1 truncate text-left\">{entry.label}</span>\n {entry.href && <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />}\n {entry.premium && <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />}\n {entry.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {entry.badge}\n </span>\n )}\n </button>\n )\n })}\n </div>\n </>\n )}\n </>\n )\n}\n","import * as React from 'react'\nimport {\n Bell, ChevronDown, Crown, ExternalLink, Home, PanelLeft, PanelLeftClose, Settings, User, X,\n type LucideIcon,\n} from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { ShellSearch } from './ShellSearch'\nimport { cn } from '../lib/cn'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { useRailFlyout, RailFlyoutProvider, type RailFlyoutContent, type RailFlyoutHandle } from './rail-flyout'\n\nexport interface NavigationItem {\n id: string\n label: string\n icon: string\n route: string\n section: 'main' | 'secondary' | 'settings'\n /**\n * Heading this item sits under, WITHIN its section.\n *\n * `section` only ever offered two labelled runs, which is enough for an app\n * rail and not enough for the settings rail: a store console needs \"Loja\" and\n * \"Commerce\" as separate headings under the same section, and folding them\n * into main/secondary would spend the plugin run on one of them. Consecutive\n * items sharing a group render under one heading, in first-appearance order;\n * items with no group render first, headed by `sectionLabels`.\n */\n group?: string\n badge?: string | number\n permission?: { feature: string; action: 'read' | 'create' | 'edit' | 'delete' }\n /** Freemium discovery: the user's role allows this item, but their plan does\n * not entitle the feature. The item stays visible with a small Crown badge\n * and, on click, leads to the plan's UpgradePrompt. */\n premium?: boolean\n /** Sales-channel / external link: when set, the item opens this URL in a new\n * tab instead of navigating an internal route. Rendered as an anchor with an\n * external-link glyph. `route` is ignored for matching when `href` is set. */\n href?: string\n children?: NavigationItem[]\n}\n\nexport interface SidebarUser {\n fullName: string\n avatarUrl?: string\n email: string\n}\n\nexport interface SidebarProps {\n navigation: NavigationItem[]\n /** O shell ainda não sabe o que esta conta tem: o rail espera em esqueleto. */\n navLoading?: boolean\n /** A leitura da configuração falhou; esta é a mensagem. */\n navError?: string | null\n navErrorLabel?: string\n navRetryLabel?: string\n onNavRetry?: () => void\n logo?: React.ReactNode\n collapsed: boolean\n onToggle: () => void\n onNavigate?: (route: string) => void\n currentPath?: string\n user?: SidebarUser\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n orgSwitcher?: React.ReactNode\n topContent?: React.ReactNode\n /**\n * A conta atual, na sua própria linha logo abaixo do cabeçalho e dentro do\n * mesmo bloco (uma borda só embaixo dos dois).\n *\n * Linha separada, e não ao lado da marca: no rail sobram ~200px, e marca +\n * avatar + nome na mesma linha reduzia o nome do cliente a \"Artorius S…\" —\n * o único dos três que o usuário não sabe de cor. Na topbar, onde a linha é a\n * tela inteira, os dois cabem lado a lado.\n */\n identity?: React.ReactNode\n /**\n * A saída do contexto (\"← Voltar para o início\"), no bloco fixo entre o\n * cabeçalho e a lista.\n *\n * Fixo e não no topo da lista: uma porta que rola para fora da tela com os\n * links deixa de ser porta, e Configurações tem lista mais alta que o rail.\n */\n navTop?: React.ReactNode\n /**\n * A row above the first destination, outside the scrolling list and outside\n * the rail-swap animation — for the one entry that is a MODE and not a page\n * (the counter/POS takeover). It stays put while the list below it swaps.\n */\n beforeNav?: React.ReactNode\n footerContent?: React.ReactNode\n /** When true, removes all borders for a cleaner framed look */\n borderless?: boolean\n /** User menu component to render at the bottom */\n userMenuSlot?: React.ReactNode\n /** Notification slot to render at the bottom */\n notificationSlot?: React.ReactNode\n /** Unread notification count for the bell indicator */\n unreadCount?: number\n /** Placeholder on the rail's search row (\"Buscar\"). The shell passes the\n * translated word; the default keeps standalone mounts readable. */\n searchLabel?: string\n /** Optional headings above each nav section. Used by contextual sidebars\n * (e.g. /settings swaps the rail for \"Settings links\" + \"Plugins\"); the\n * normal app rail leaves them undefined and renders no headings. */\n sectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** Identity of the current rail context. When it changes, the rail animates\n * as a push: the new nav slides in while the previous one slides out.\n * Leave undefined for a static rail (no swap animation). */\n navKey?: string\n /** Push direction for a `navKey` change. 'forward' pulls the new rail in\n * from the right (drilling in), 'back' from the left (returning). */\n navDirection?: 'forward' | 'back'\n /**\n * Render a group's children as bare labels with an elbow (↳) marking the\n * active one, instead of the icon-per-child list. Icons on children make a\n * group read as a second flat menu; the elbow says \"you are inside this one\"\n * with a single mark. Off by default — it changes every existing rail.\n */\n navChildConnector?: boolean\n /**\n * Mobile drawer mount. The rail's own collapse control makes no sense in a\n * sheet that is already either open or gone, so `onToggle` becomes a close\n * button in the identity row instead of the collapse toggle in the footer.\n */\n drawer?: boolean\n}\n\n// ICON_MAP now lives in ../icons (central curated registry, shared by every\n// string-name icon lookup in the SDK); re-exported here for compat.\nexport { ICON_MAP }\n\n/** Kept in sync with --saas-rail-duration in styles.css. */\nconst RAIL_PUSH_MS = 260\n\n/** Layout effect on the client, plain effect during SSR (avoids the warning).\n * The rail push needs the layout variant: the animation classes must be on\n * the DOM before paint, or the new rail shows one frame at its final spot. */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction getIcon(name: string): LucideIcon {\n return ICON_MAP[name] ?? Home\n}\n\n/** What the collapsed rail hands the flyout for an item. */\nfunction flyoutContentOf(item: NavigationItem): RailFlyoutContent {\n return {\n key: item.id,\n label: item.label,\n route: item.route,\n href: item.href,\n premium: item.premium,\n badge: item.badge,\n entries: item.children?.map((child) => ({\n id: child.id,\n label: child.label,\n icon: child.icon,\n route: child.route,\n href: child.href,\n premium: child.premium,\n badge: child.badge,\n })),\n }\n}\n\nfunction NavItem({\n item,\n collapsed,\n isActive,\n onNavigate,\n flyout,\n}: {\n item: NavigationItem\n collapsed: boolean\n isActive: boolean\n onNavigate: (route: string) => void\n flyout?: RailFlyoutHandle\n}) {\n const Icon = getIcon(item.icon)\n const isExternal = !!item.href\n // Collapsed rail: the label (and any children) live in the shared flyout —\n // the rail itself shows nothing but the glyph.\n const hoverProps = collapsed && flyout ? flyout.rowProps(flyoutContentOf(item)) : undefined\n\n const className = cn(\n // 36px rows. The rail was condensed to 28px while it listed every\n // destination flat; with the destinations folded into collapsible groups it\n // shows a handful of rows at rest, and at that length the tight rhythm read\n // as cramped rather than as dense.\n 'flex w-full items-center gap-3 rounded-button px-2.5 py-2 text-[13px] font-medium transition-colors',\n 'hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n isActive\n // No shadow. The rail is a flat field of one tone and a drop shadow on it\n // reads as grime rather than as lift — the fill alone says \"here\".\n ? 'bg-sidebar-accent font-semibold text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/80',\n collapsed && 'justify-center px-2',\n )\n\n const inner = (\n <>\n <Icon className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n {isExternal && (\n <ExternalLink className=\"ml-auto h-3.5 w-3.5 shrink-0 opacity-50\" aria-hidden />\n )}\n {item.premium && (\n <Crown className={cn('h-3.5 w-3.5 shrink-0 text-amber-500', !isExternal && 'ml-auto')} aria-hidden />\n )}\n {item.badge !== undefined && (\n <span className={cn('rounded-full bg-primary px-2 py-0.5 text-xs font-semibold text-primary-foreground', !isExternal && !item.premium && 'ml-auto')}>\n {item.badge}\n </span>\n )}\n </>\n )}\n </>\n )\n\n // Every menu entry is a tour anchor, keyed by its own route. It costs one\n // attribute and it is what lets the assistant point at \"Pedidos\" — the\n // alternative is a registry of hand-placed anchors that goes stale the first\n // time a plugin renames a page.\n const anchor = `nav.${item.route}`\n\n return isExternal ? (\n <a href={item.href} target=\"_blank\" rel=\"noopener noreferrer\" className={className} {...hoverProps}>\n {inner}\n </a>\n ) : (\n <button\n onClick={() => {\n flyout?.dismiss()\n onNavigate(item.route)\n }}\n className={className}\n data-tour={anchor}\n {...hoverProps}\n >\n {inner}\n </button>\n )\n}\n\n/** How specifically `route` matches `path` (-1 = no match; higher = more specific).\n * An exact match beats a prefix match; a longer prefix beats a shorter one. */\nfunction routeMatchScore(route: string, path: string): number {\n if (path === route) return route.length + 1\n if (route !== '/' && path.startsWith(route + '/')) return route.length\n return -1\n}\n\n/** The single most-specific nav route that matches the current path (longest wins).\n * Prevents a parent like `/courses` from staying active on `/courses/sales`. */\nfunction resolveActiveRoute(navigation: NavigationItem[], path: string): string | null {\n let best: string | null = null\n let bestScore = 0\n const consider = (route?: string) => {\n if (!route) return\n const score = routeMatchScore(route, path)\n if (score > bestScore) { bestScore = score; best = route }\n }\n for (const item of navigation) {\n consider(item.route)\n for (const child of item.children ?? []) consider(child.route)\n }\n return best\n}\n\nfunction NavGroup({\n item,\n collapsed,\n activeRoute,\n onNavigate,\n childConnector,\n flyout,\n}: {\n item: NavigationItem\n collapsed: boolean\n activeRoute: string | null\n onNavigate: (route: string) => void\n childConnector?: boolean\n flyout?: RailFlyoutHandle\n}) {\n const isChildActive = item.children?.some((c) => c.route === activeRoute)\n const [open, setOpen] = React.useState(() => isChildActive ?? false)\n const Icon = getIcon(item.icon)\n\n if (collapsed) {\n // The children are the whole point of pointing at a group in a 4rem rail:\n // clicking through to the parent to discover them is a round trip the\n // pointer already paid for.\n const hoverProps = flyout?.rowProps(flyoutContentOf(item))\n return (\n <button\n onClick={() => {\n flyout?.dismiss()\n onNavigate(item.route)\n }}\n data-tour={`nav.${item.route}`}\n className={cn(\n 'flex w-full items-center justify-center rounded-button px-2 py-2 text-sm font-medium transition-colors',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n isChildActive ? 'bg-sidebar-accent text-sidebar-accent-foreground' : 'text-sidebar-muted'\n )}\n {...hoverProps}\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n </button>\n )\n }\n\n return (\n <div>\n {/* Metrics and resting colour are NavItem's, deliberately: a group header\n and a plain link are peers in the rail, and rendering the group in\n text-sidebar-muted read as \"disabled\" next to its own siblings. */}\n <button\n onClick={() => setOpen(!open)}\n className={cn(\n // Same metrics as NavItem — a group header and a plain link are peers\n // in the rail and must share a baseline.\n 'flex w-full items-center gap-3 rounded-button px-2.5 py-2 text-[13px] font-medium transition-colors',\n 'hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n isChildActive ? 'text-sidebar-accent-foreground' : 'text-sidebar-foreground/80'\n )}\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n <ChevronDown className={cn('h-3.5 w-3.5 shrink-0 transition-transform', open && 'rotate-180')} />\n </button>\n {open && (\n <div className={cn(\n 'mt-0.5',\n // Connector mode has no per-child icon and no running rule: the line\n // is DRAWN, from the parent down to the active child and curving into\n // it. Extra left padding reserves the column that line lives in.\n //\n // No row gap (space-y-*) here: the line is assembled from one segment\n // per row, so any gap between rows shows up as a break in what has to\n // read as a single continuous stroke. Rows carry a fixed h-8 instead,\n // which is also what makes the elbow's y=16 land on their centre.\n //\n // The indent lives on the ROWS, not here: the connector is positioned\n // from this box's left edge, so padding it would push the line right\n // along with the labels and land the arrowhead on top of the text.\n childConnector ? 'relative' : 'ml-4 space-y-0.5 border-l border-sidebar-border/50 pl-3',\n )}>\n {item.children?.map((child, childIndex) => {\n const ChildIcon = getIcon(child.icon)\n const isActive = child.route === activeRoute\n const childExternal = !!child.href\n const childClass = cn(\n 'flex w-full items-center rounded-button text-sm transition-colors',\n // pl-11 clears the connector (whose arrowhead ends at ~24px) with\n // room to spare, so the children read as one clearly indented\n // column rather than crowding the line that points at them.\n childConnector ? 'h-8 gap-0 pl-11 pr-1' : 'gap-2.5 px-2 py-1.5',\n isActive\n ? 'font-medium text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/70 hover:text-sidebar-accent-foreground'\n )\n const childInner = (\n <>\n {childConnector ? null : <ChildIcon className=\"mr-2.5 h-3.5 w-3.5 shrink-0\" />}\n <span className=\"flex-1 truncate text-left\">{child.label}</span>\n {childExternal && (\n <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />\n )}\n {child.premium && (\n <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />\n )}\n </>\n )\n const row = childExternal ? (\n <a href={child.href} target=\"_blank\" rel=\"noopener noreferrer\" className={childClass}>\n {childInner}\n </a>\n ) : (\n // `nav.<route>` on group children too, matching the top-level rows\n // above — without it a guided tour cannot point at \"Cardápio\",\n // \"Reservas\" or any other row that lives under a group (the normal\n // case in an app that groups its rail).\n <button data-tour={`nav.${child.route}`} onClick={() => onNavigate(child.route)} className={childClass}>\n {childInner}\n </button>\n )\n\n if (!childConnector) return <React.Fragment key={child.id}>{row}</React.Fragment>\n\n // The line runs from the parent down to the active child and stops\n // there, curving in with an arrowhead. Children ABOVE the active one\n // carry the straight segment; the active one carries the elbow;\n // below it, nothing — a rule continuing past the destination would\n // be drawing a relationship that doesn't point anywhere.\n const activeIndex = item.children!.findIndex((c) => c.route === activeRoute)\n const onPath = activeIndex >= 0 && childIndex < activeIndex\n // The straight segment is butt-ended (no rounded cap) and spans the\n // row edge to edge, so consecutive rows join into one unbroken line.\n return (\n // The connector's colour is set HERE, on the wrapper, and BOTH\n // halves inherit it: the straight segments and the elbow are one\n // line, so a different opacity on either makes the stroke change\n // shade halfway down. Weight matches too — the span is 1.5px wide\n // and the path is stroke-width 1.5 on the same 13.75px centre.\n //\n // Set on the wrapper rather than inherited from the row: rows dim\n // to /70 when inactive, and a line fading along with the label it\n // points AT was nearly invisible on a dark rail.\n <div key={child.id} className=\"relative h-8 text-sidebar-foreground/45\">\n {onPath && (\n <span\n aria-hidden\n className=\"pointer-events-none absolute bottom-0 left-[13px] top-0 w-[1.5px] bg-current\"\n />\n )}\n {isActive && (\n <svg\n aria-hidden\n className=\"pointer-events-none absolute left-1 top-0\"\n width=\"21\" height=\"32\" viewBox=\"0 0 21 32\" fill=\"none\"\n >\n {/* Down the same 9.75px column the segments use, then a\n quarter-turn into the label's vertical centre (y=16 of\n the 32px row). */}\n <path d=\"M9.75 0 V11 Q9.75 16 14.75 16 H20\"\n stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" fill=\"none\" />\n <path d=\"M17 13 L20 16 L17 19\"\n stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\n </svg>\n )}\n {row}\n </div>\n )\n })}\n </div>\n )}\n </div>\n )\n}\n\n/**\n * Hand a sidebar slot the collapsed state — but only if it can receive it.\n *\n * The slots are `React.ReactNode`, so a host may pass a component OR a plain\n * `<button>`. Cloning a DOM element with `{ collapsed }` puts the prop on the\n * tag, and React warns: *Received `false` for a non-boolean attribute*. That is\n * exactly what the settings back-link did — a bare `<button>`, so the warning\n * appeared only inside Configurações and nowhere else.\n *\n * `typeof type === 'string'` is a DOM tag; anything else is a component, which\n * may or may not use the prop but will not leak it to the DOM by accident.\n */\nfunction withCollapsed(slot: React.ReactNode, collapsed: boolean): React.ReactNode {\n if (!React.isValidElement(slot)) return slot\n if (typeof slot.type === 'string') return slot\n return React.cloneElement(slot as React.ReactElement<any>, { collapsed })\n}\n\n/**\n * As costelas do rail enquanto ele não chegou. CINCO, e não sete.\n *\n * O esqueleto não é uma previsão — ninguém sabe quantas linhas a conta tem\n * antes da configuração. Ele é só a promessa de que ALGO vem ali. Sete barras\n * ocupavam metade da coluna e prometiam um menu específico; cinco dizem a mesma\n * coisa sem fingir que sabem o tamanho, e a diferença entre elas e o rail real\n * deixa de ser um salto.\n *\n * Fixo de propósito: sortear larguras a cada render faria o esqueleto tremer\n * enquanto espera.\n */\nconst SKELETON_ROWS = [\n { width: 56, group: false },\n { width: 68, group: true },\n { width: 48, group: false },\n { width: 60, group: true },\n { width: 52, group: false },\n] as const\n\nexport function Sidebar({\n navigation,\n navLoading = false,\n navError,\n navErrorLabel,\n navRetryLabel,\n onNavRetry,\n logo,\n collapsed,\n onToggle,\n onNavigate,\n currentPath: currentPathProp = '/',\n user: _user,\n orgSwitcher,\n topContent,\n identity,\n navTop,\n beforeNav,\n footerContent,\n borderless,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel = 'Search',\n sectionLabels,\n navKey,\n navDirection = 'forward',\n navChildConnector,\n drawer,\n}: SidebarProps) {\n const currentPath = currentPathProp\n\n // Most-specific match wins, so sibling routes that share a prefix (e.g.\n // /courses vs /courses/sales) don't both light up.\n\n const activeRoute = resolveActiveRoute(navigation, currentPath)\n\n const railRef = React.useRef<HTMLElement | null>(null)\n const flyout = useRailFlyout({\n enabled: collapsed,\n railRef,\n activeRoute,\n onNavigate: (route) => onNavigate?.(route),\n })\n\n const mainItems = navigation.filter((item) => item.section === 'main')\n const secondaryItems = navigation.filter((item) => item.section === 'secondary')\n const settingsItems = navigation.filter((item) => item.section === 'settings')\n\n const handleNavigate = (route: string) => {\n onNavigate?.(route)\n }\n\n const sectionHeading = (label?: string) =>\n label && !collapsed ? (\n <p className=\"px-2.5 pb-0.5 pt-1 text-[10px] font-semibold uppercase tracking-wider text-sidebar-muted\">\n {label}\n </p>\n ) : null\n\n // Runs of consecutive items sharing a `group`, in first-appearance order. The\n // ungrouped run keeps `sectionLabels` as its heading, so a rail that declares\n // no groups renders byte-identically to before.\n const groupRuns = (items: NavigationItem[]): Array<{ group?: string; items: NavigationItem[] }> => {\n const runs: Array<{ group?: string; items: NavigationItem[] }> = []\n for (const item of items) {\n const last = runs[runs.length - 1]\n if (last && last.group === item.group) last.items.push(item)\n else runs.push({ group: item.group, items: [item] })\n }\n return runs\n }\n\n const renderSection = (items: NavigationItem[], label?: string) => {\n const runs = groupRuns(items)\n return runs.map((run, i) => (\n // 4px between rows, 20px between runs (a run being a `group` heading's\n // worth of entries — see NavigationItem.group).\n <div key={run.group ?? `ungrouped-${i}`} className={i === 0 ? 'space-y-1' : 'mt-5 space-y-1'}>\n {sectionHeading(run.group ?? label)}\n {run.items.map(renderItem)}\n </div>\n ))\n }\n\n const renderItem = (item: NavigationItem) =>\n item.children && item.children.length > 0 ? (\n <NavGroup key={item.id} item={item} collapsed={collapsed} activeRoute={activeRoute} onNavigate={handleNavigate} childConnector={navChildConnector} flyout={flyout} />\n ) : (\n <NavItem\n key={item.id}\n item={item}\n collapsed={collapsed}\n isActive={item.route === activeRoute}\n onNavigate={handleNavigate}\n flyout={flyout}\n />\n )\n\n // The swappable part of the rail (top slot + both nav sections). Kept as one\n // node so a context change can snapshot the outgoing rail and animate it out.\n const navBody = (\n <>\n {mainItems.length > 0 && renderSection(mainItems, sectionLabels?.main)}\n {secondaryItems.length > 0 && (\n <div className=\"mt-6\">{renderSection(secondaryItems, sectionLabels?.secondary)}</div>\n )}\n </>\n )\n\n // Rail push: when `navKey` changes, hold the previous rail on screen for one\n // animation cycle. `lastBodyRef` is refreshed after every render, so the\n // snapshot is the rail exactly as it looked before the swap (correct active\n // item included) rather than a stale one.\n const [outgoing, setOutgoing] = React.useState<{ body: React.ReactNode; direction: 'forward' | 'back' } | null>(null)\n const lastBodyRef = React.useRef<React.ReactNode>(null)\n const lastKeyRef = React.useRef(navKey)\n const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useIsomorphicLayoutEffect(() => {\n if (lastKeyRef.current !== navKey) {\n const previousBody = lastBodyRef.current\n lastKeyRef.current = navKey\n if (previousBody) {\n setOutgoing({ body: previousBody, direction: navDirection })\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setOutgoing(null), RAIL_PUSH_MS)\n }\n }\n lastBodyRef.current = navBody\n })\n\n React.useEffect(() => () => { if (timerRef.current) clearTimeout(timerRef.current) }, [])\n\n return (\n // O handle do flyout desce por contexto para QUALQUER linha da trilha —\n // inclusive os widgets que os plugins montam no pé dela. Ver useRailRow.\n <RailFlyoutProvider value={flyout}>\n <aside\n ref={railRef}\n data-print=\"hide\"\n onBlur={(event) => {\n // Focus left the rail entirely (tabbing past it) — the panel goes with\n // it. Moving between rows / into the panel stays inside.\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) flyout.dismiss()\n }}\n className={cn(\n // `relative` anchors the flyout, which hangs off the rail's right edge\n // and has to escape the nav's own scroll box to do it.\n 'relative flex h-full flex-col bg-sidebar text-sidebar-foreground transition-all duration-200',\n !borderless && 'border-r border-sidebar-border',\n // 14rem expanded. It was 16rem, which is the width a rail needs when\n // its entries are sentences (\"GlossGenius Financing\", \"Configure your\n // payment methods\"); these are one or two words, so the extra 2rem was\n // paid for by the content column on every screen in every app. The\n // labels still truncate, and a long one now truncates 32px earlier —\n // which is the trade, taken deliberately.\n // A largura da GAVETA vai em `style`, logo abaixo — ver o porquê lá.\n collapsed ? 'w-16' : !drawer && 'w-56',\n )}\n // A gaveta do celular é mais larga que o rail do desktop, e de propósito:\n // lá os 2rem a menos devolvem espaço à coluna de conteúdo, que divide a\n // tela com o rail; aqui não há divisão — a gaveta cobre a página —, então\n // estreitar não compra nada e só trunca nome de seção mais cedo.\n //\n // E vai em `style`, não em classe: quem gera o CSS é o Tailwind do APP, e\n // ele não varre este fonte. Classe nova aqui simplesmente não existe do\n // outro lado — `w-56` só funcionava por já estar no CSS publicado, e\n // qualquer substituta (`w-72`, `w-[min(...)]`) saía sem regra nenhuma,\n // deixando a gaveta sem largura e espremida contra a borda.\n style={drawer && !collapsed ? { width: 'min(18rem, 85vw)' } : undefined}\n >\n {/* Identity block — quem é o produto, e em qual conta você está.\n\n Uma linha só, quando não há conta a nomear: aí o `topContent` (ou o\n `logo`) fica no h-14, que é a altura do cabeçalho da página e da\n cabeça do painel do assistente — as três correm na mesma linha em vez\n de escadinha.\n\n Com conta, duas: a marca vira uma tira estreita em cima e a conta fica\n com uma linha inteira embaixo. Lado a lado só cabia \"Artorius S…\" — em\n ~200px, marca, avatar e nome disputam, e o nome é justamente o único\n dos três que o usuário não sabe de cor. Custa ~40px de cromo, pagos\n uma vez no topo; a alternativa é truncar a informação que muda.\n\n The collapse toggle moved to the footer — see the utility row at the\n bottom. It is chrome, and it was sitting inside the one row that has\n to say where you are. */}\n <div className={cn('shrink-0', !borderless && 'border-b border-sidebar-border')}>\n <div\n className={cn(\n 'flex items-center gap-1 px-2',\n // h-12 com a conta embaixo (48 + 44 + 8 = 100px, na régua de 4/8),\n // h-14 quando a marca é a única coisa aqui e a linha tem de bater\n // com o cabeçalho da página.\n identity ? 'h-12' : 'h-14',\n collapsed && 'justify-center',\n // `logo === null` é uma opinião, não a falta de uma: quer dizer\n // \"esta casa não é marcada pelo produto\". A linha da marca então\n // não existe, e o rail abre direto no seletor de conta — o ícone da\n // casa, o nome e o chevron, numa linha só. `undefined` continua\n // caindo no rótulo padrão, que é o que um app sem logo sempre teve.\n logo === null && !topContent && 'hidden',\n )}\n >\n {topContent ? (\n <div className={cn('min-w-0', collapsed ? 'flex justify-center' : 'flex-1')}>\n {withCollapsed(topContent, collapsed)}\n </div>\n ) : (\n !collapsed && (\n <div className=\"min-w-0 flex-1 px-1.5\">{logo ?? <span className=\"text-lg font-bold\">App</span>}</div>\n )\n )}\n {drawer && (\n <button\n onClick={onToggle}\n // 36px de alvo, não 28: é um controle para o POLEGAR, e ficava\n // menor que o próprio selo do produto ao lado — pequeno demais\n // para acertar e leve demais para parecer o fechar da gaveta.\n className=\"fz-tap flex h-9 w-9 shrink-0 items-center justify-center rounded-button text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label=\"Close menu\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n )}\n </div>\n {identity && (\n // Sem a linha da marca acima, a conta encosta no topo da janela. O ar\n // que a marca ocupava continua sendo necessário: é o que separa o\n // conteúdo do rail da borda do navegador.\n <div\n className={cn(\n 'px-2 pb-2',\n logo === null && !topContent && 'pt-3',\n collapsed && 'flex justify-center',\n )}\n >\n {withCollapsed(identity, collapsed)}\n </div>\n )}\n </div>\n\n {/* O bloco fixo entre o cabeçalho e a lista. Dentro de um contexto\n (Configurações, um módulo que tomou o rail) ele é a saída; fora dele,\n a busca. Um de cada vez, no mesmo lugar: são as duas coisas que valem\n antes do primeiro destino, e empilhá-las afastava a lista do topo para\n hospedar uma promessa de saída que o contexto já faz. */}\n {/* Busca, logo abaixo do seletor de conta: respondido \"em qual conta\n estou\", a pergunta seguinte é \"onde está X\". Fica no trilho e não no\n meio da barra da página porque a barra pertence à TELA — ali a busca\n do produto inteiro era lida como um filtro do que está aberto.\n Clicar abre a mesma paleta do ⌘K: é botão, não campo.\n\n UMA DE CADA VEZ, NO MESMO LUGAR. Dentro de um contexto (Configurações,\n Análises, um módulo que tomou o trilho) este bloco é a SAÍDA, não a\n busca. Empilhar as duas dava dois campos de busca em cima um do outro\n — a global aqui e a do próprio módulo logo abaixo (\"Buscar\n relatórios\") — e duas caixas iguais separadas por uma seta de voltar\n não dizem qual delas procura onde. Fora de contexto, quem ocupa o\n lugar é a busca; dentro dele, a saída. */}\n {navTop ? (\n <div className={cn('px-2 pb-2 pt-2', collapsed && 'flex justify-center')}>\n {withCollapsed(navTop, collapsed)}\n </div>\n ) : (\n <div className={cn('px-2 pb-2 pt-2', collapsed && 'flex justify-center')}>\n <ShellSearch tone=\"rail\" collapsed={collapsed} label={searchLabel} />\n </div>\n )}\n\n {beforeNav && (\n <div className={cn('px-2 pb-1 empty:hidden', collapsed && 'flex justify-center')}>\n {withCollapsed(beforeNav, collapsed)}\n </div>\n )}\n\n {/* Enquanto o shell ainda não sabe o que esta conta tem, o rail espera\n em esqueleto. Uma lista curta que depois cresce é pior que nenhuma:\n ela muda embaixo do olho de quem já começou a ler, e por um instante\n promete um sistema menor do que o que a conta tem.\n\n ── Por que ele ocupa o espaço desde o primeiro quadro ──────────────\n Antes o esqueleto entrava por `setTimeout(140ms)`, e nesses 140ms o\n rail ficava VAZIO — a lista real já está `hidden`. Eram três estados\n em sequência: branco, esqueleto, rail. O branco é o que se lia como\n salto, porque é o único em que a coluna não tem altura nenhuma.\n\n Agora ele está montado o tempo todo da espera e só a OPACIDADE é\n adiada: numa resposta de 80ms o usuário não vê barra cinza nenhuma\n (elas nunca chegam a aparecer), e numa lenta a coluna já tinha a\n altura certa antes de ficar visível. O atraso continua cobrindo a\n resposta rápida; o que ele deixou de cobrar é o quadro em branco. */}\n {/* A leitura falhou. Antes disso o shell desenhava o rail PADRÃO DO PACOTE\n — uma linha, \"Painel\" — e o seletor oferecia \"criar área de trabalho\":\n a resposta de quem não tem conta nenhuma, dada a quem tem sete e não\n conseguiu lê-las. Um erro que se parece com um estado normal é pior\n que um erro, porque ninguém vai atrás dele. */}\n {navError && !navLoading && (\n <div className=\"flex-1 px-3 py-4\">\n <p className=\"text-sm font-medium text-sidebar-foreground\">\n {navErrorLabel ?? 'Não foi possível carregar o menu'}\n </p>\n <p className=\"mt-1 text-xs leading-relaxed text-sidebar-muted\">{navError}</p>\n {onNavRetry && (\n <button\n type=\"button\"\n onClick={onNavRetry}\n className=\"fz-tap mt-3 rounded-button bg-sidebar-accent px-2.5 py-1.5 text-xs font-medium text-sidebar-accent-foreground transition-colors hover:brightness-110\"\n >\n {navRetryLabel ?? 'Tentar de novo'}\n </button>\n )}\n </div>\n )}\n\n {navLoading && (\n <nav\n aria-busy\n aria-label=\"Carregando menu\"\n className=\"fz-rail-skeleton flex-1 space-y-1 p-2\"\n >\n {SKELETON_ROWS.map((row, i) => (\n <div key={i} className=\"flex h-9 items-center gap-3 rounded-button px-2.5\">\n <span className=\"h-4 w-4 shrink-0 rounded bg-sidebar-foreground/10\" />\n {!collapsed && (\n <>\n {/* Larguras desiguais: barras idênticas leem como tabela, não\n como um menu que está chegando. */}\n <span className=\"h-3 rounded bg-sidebar-foreground/10\" style={{ width: `${row.width}%` }} />\n {/* Duas linhas com seta, porque o rail real tem rubricas: um\n esqueleto todo de folhas anuncia um menu mais raso do que\n o que vai chegar. */}\n {row.group && (\n <span className=\"ml-auto h-3 w-3 shrink-0 rounded bg-sidebar-foreground/[0.07]\" />\n )}\n </>\n )}\n </div>\n ))}\n </nav>\n )}\n\n {/* Main Navigation. During a rail swap the outgoing nav is pinned on\n top of the incoming one so the two cross-slide; overflow is clipped\n for the duration so neither pane can scroll the rail sideways. */}\n <nav\n hidden={navLoading || !!navError}\n className={cn(\n 'relative flex-1 p-2',\n // Entra em fade: o rail é a primeira coisa que alguém lê depois de\n // escolher a conta, e aparecer de uma vez lê como sobressalto.\n 'duration-300 animate-in fade-in',\n // scrollbar-none: the rail still scrolls, but without the native\n // scrollbar gutter eating into the nav items.\n outgoing ? 'overflow-hidden' : 'overflow-y-auto scrollbar-none',\n )}\n >\n {outgoing && (\n <div\n aria-hidden\n className={cn(\n 'pointer-events-none absolute inset-x-2 top-2 space-y-1',\n outgoing.direction === 'back' ? 'saas-rail-out-back' : 'saas-rail-out-forward',\n )}\n >\n {outgoing.body}\n </div>\n )}\n <div\n key={navKey}\n className={cn(\n 'space-y-1',\n outgoing && (outgoing.direction === 'back' ? 'saas-rail-in-back' : 'saas-rail-in-forward'),\n )}\n >\n {navBody}\n </div>\n </nav>\n\n {/* Settings nav items */}\n {settingsItems.length > 0 && (\n <div className={cn('p-2 space-y-1', !borderless && 'border-t border-sidebar-border')}>\n {settingsItems.map((item) => (\n <NavItem\n key={item.id}\n item={item}\n collapsed={collapsed}\n isActive={item.route === activeRoute}\n onNavigate={handleNavigate}\n flyout={flyout}\n />\n ))}\n </div>\n )}\n\n {footerContent && (\n // `empty:hidden` — slot children may all render null (e.g. the\n // SeuSiteWidget self-hides when the tenant has no project); without\n // it the padded/bordered wrapper shows as a blank block.\n <div className={cn('space-y-2 p-2 empty:hidden', !borderless && 'border-t border-sidebar-border')}>\n {footerContent}\n </div>\n )}\n\n {/* Org Switcher — above user row */}\n {withCollapsed(orgSwitcher, collapsed)}\n\n {/* Bottom: User row with inline action icons */}\n {/* Sits ON the bottom edge. It used to reserve the tab bar's 64px, which\n was wrong twice over: the drawer is drawn ABOVE the bar and covers it\n across its own width, so the reservation bought nothing and left a\n band of empty drawer under the last row. Only the home indicator is\n real here, and env() is 0 wherever there is none. */}\n <div\n // No horizontal padding: the org switcher above renders bare, so its\n // own px-1.5 is the whole inset. Matching it here is what puts the two\n // avatars on one vertical line. `pr-2` keeps the bell off the edge.\n className={cn('py-2', collapsed ? 'px-2' : 'pr-2', !borderless && 'border-t border-sidebar-border')}\n style={drawer ? { paddingBottom: 'calc(0.5rem + env(safe-area-inset-bottom))' } : undefined}\n >\n <div className={cn(\n 'flex items-center rounded-button',\n collapsed ? 'flex-col justify-center gap-1' : 'gap-1'\n )}>\n {/* The user menu is a row when there is room and a portrait when there\n is not — it has to be TOLD which, like every other slot here. */}\n {withCollapsed(userMenuSlot, collapsed)}\n\n {/* Spacer pushes icons to right when expanded */}\n {!collapsed && <div className=\"flex-1\" />}\n\n {/* Notification slot or default bell */}\n {withCollapsed(notificationSlot, collapsed) ?? (\n <button\n {...(collapsed\n ? flyout.rowProps({\n key: 'notifications',\n label: unreadCount > 0 ? `Notificações (${unreadCount})` : 'Notificações',\n })\n : {})}\n className=\"fz-tap relative inline-flex shrink-0 items-center justify-center rounded-button p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground\"\n aria-label={unreadCount > 0 ? `${unreadCount} unread notifications` : 'Notifications'}\n >\n <Bell className=\"h-4 w-4\" />\n {unreadCount > 0 && (\n <span className=\"absolute right-1 top-1 h-2 w-2 rounded-full bg-destructive\" />\n )}\n </button>\n )}\n\n {/* Collapse — down here with the other utilities rather than in the\n identity row it used to share with the workspace name. Width is\n the rail's own setting, not something you say about the workspace\n you are in, and this is the corner every rail keeps it in. */}\n {!drawer && (\n <button\n onClick={onToggle}\n {...(collapsed ? flyout.rowProps({ key: 'expand-sidebar', label: 'Expandir menu' }) : {})}\n className=\"fz-tap inline-flex shrink-0 items-center justify-center rounded-button p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground\"\n aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n title={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n >\n {collapsed ? <PanelLeft className=\"h-4 w-4\" /> : <PanelLeftClose className=\"h-4 w-4\" />}\n </button>\n )}\n </div>\n </div>\n\n {/* The rail's one flyout — anchored to whichever row is being pointed\n at, so it slides between them instead of blinking per row. */}\n {flyout.panel}\n </aside>\n </RailFlyoutProvider>\n )\n}\n","import * as React from 'react'\nimport * as Popover from '@radix-ui/react-popover'\nimport {\n Menu,\n Search,\n ChevronDown,\n Home,\n Settings,\n CreditCard,\n UserCog,\n Crown,\n Sparkles,\n LogOut,\n type LucideIcon,\n} from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\nimport { useLayoutStore } from '../stores/layout.store'\n\nexport interface NavigationItem {\n id: string\n label: string\n icon: string\n route: string\n section: 'main' | 'secondary' | 'settings'\n /** Heading this item sits under within its section. Honoured by the sidebar\n * rail; the topbar has no headings and ignores it. */\n group?: string\n badge?: string | number\n children?: NavigationItem[]\n permission?: { feature: string; action: 'read' | 'create' | 'edit' | 'delete' }\n /** Freemium discovery: role-allowed but not entitled by the current plan.\n * Renders a small Crown badge; clicking leads to the plan's UpgradePrompt. */\n premium?: boolean\n}\n\nexport interface TopbarProps {\n navigation: NavigationItem[]\n logo?: React.ReactNode\n user?: { fullName: string; avatarUrl?: string; email: string }\n onMenuClick?: () => void\n /** Hide the chrome row on phones. Set when a bottom bar carries navigation:\n * what is left of this row on a phone is a logo the user cannot act on and\n * icons that the navigation sheet already offers, so it is 56px of nothing. */\n hideMobileChrome?: boolean\n /** Workspace/org switcher rendered with the right-side actions (desktop). */\n orgSwitcher?: React.ReactNode\n leftContent?: React.ReactNode\n rightContent?: React.ReactNode\n currentPath?: string\n onNavigate?: (route: string) => void\n searchPlaceholder?: string\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n /** Current-plan pill shown next to the user in the dropdown header. */\n userPlan?: { label: string; paid: boolean }\n /** i18n label for the billing/subscription menu item (host owns translation). */\n billingLabel?: string\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n /**\n * O menu do usuário, quando o host desenha o dele — o MESMO que o rail\n * recebe. Sem isto, cada layout tinha o seu: o de topbar nasceu sem seletor\n * de tema nem de idioma e com \"Perfil\"/\"Sair\" escritos em português no\n * código, então trocar o produto de layout trocava o que o menu oferece.\n */\n userMenuSlot?: React.ReactNode\n}\n\nfunction TopbarUserMenu({\n user,\n userPlan,\n billingLabel = 'Subscription',\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userMenuExtras,\n}: Pick<TopbarProps, 'user' | 'userPlan' | 'billingLabel' | 'onSignOut' | 'onProfile' | 'onSettings' | 'onBilling' | 'userMenuExtras'>) {\n const [open, setOpen] = React.useState(false)\n if (!user) return null\n const initial = (user.fullName?.trim()?.[0] ?? user.email?.[0] ?? '?').toUpperCase()\n const item = (label: string, onClick?: () => void, Icon?: LucideIcon) =>\n onClick ? (\n <button\n key={label}\n onClick={() => { setOpen(false); onClick() }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70\"\n >\n {Icon && <Icon className=\"h-4 w-4 text-muted-foreground\" />}\n <span>{label}</span>\n </button>\n ) : null\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <button\n aria-label=\"User menu\"\n className=\"ml-1 flex h-9 w-9 items-center justify-center overflow-hidden rounded-full bg-primary text-xs font-semibold text-primary-foreground ring-2 ring-transparent transition hover:ring-sidebar-border\"\n >\n {user.avatarUrl ? (\n // eslint-disable-next-line @next/next/no-img-element\n <img src={user.avatarUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n initial\n )}\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n align=\"end\"\n sideOffset={8}\n className=\"fayz-glass-surface z-50 min-w-[220px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n <div className=\"border-b border-border px-3 py-2\">\n <p className=\"truncate text-sm font-medium text-foreground\">{user.fullName || user.email}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{user.email}</p>\n </div>\n <div className=\"mt-1 space-y-0.5\">\n {item('Perfil', onProfile, UserCog)}\n {item('Configurações', onSettings, Settings)}\n {onBilling && (\n <button\n key=\"billing\"\n onClick={() => { setOpen(false); onBilling() }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70\"\n >\n <CreditCard className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"flex-1 text-left\">{billingLabel}</span>\n {userPlan && (\n <span\n className={\n userPlan.paid\n ? 'inline-flex items-center gap-1 rounded-full border border-amber-400/40 bg-amber-400/15 px-2 py-0.5 text-[10px] font-semibold text-amber-600 dark:text-amber-300'\n : 'inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground'\n }\n >\n {userPlan.paid ? <Crown className=\"h-3 w-3\" /> : <Sparkles className=\"h-3 w-3\" />}\n {userPlan.label}\n </span>\n )}\n </button>\n )}\n {userMenuExtras?.map((e) => item(e.label, e.onClick))}\n {onSignOut && (\n <>\n <div className=\"my-1 border-t border-border\" />\n {item('Sair', onSignOut, LogOut)}\n </>\n )}\n </div>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\n// Um mapa só. A barra do topo mantinha o seu, menor: um nome que existia apenas\n// no registro central (User, Palette, ShieldCheck) desenhava ícone num lugar e\n// nenhum no outro — as linhas de Configurações apareciam sem ícone.\nexport { ICON_MAP }\n\nfunction getIcon(name: string): LucideIcon {\n return ICON_MAP[name] ?? Home\n}\n\nfunction NavDropdown({ item, currentPath, onNavigate }: {\n item: NavigationItem\n currentPath: string\n onNavigate: (route: string) => void\n}) {\n const [open, setOpen] = React.useState(false)\n const Icon = getIcon(item.icon)\n const isChildActive = item.children?.some(\n (child) => currentPath === child.route || currentPath.startsWith(child.route + '/')\n )\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <button\n data-nav-active={isChildActive || undefined}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors',\n isChildActive\n ? 'border-sidebar-accent-foreground font-semibold text-sidebar-foreground'\n : 'border-transparent text-sidebar-muted hover:text-sidebar-foreground'\n )}\n >\n <Icon className=\"h-4 w-4\" />\n <span>{item.label}</span>\n <ChevronDown className={cn('h-3 w-3 transition-transform', open && 'rotate-180')} />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"fayz-glass-surface z-50 min-w-[200px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n {item.children?.map((child) => {\n const ChildIcon = getIcon(child.icon)\n const isActive = currentPath === child.route || currentPath.startsWith(child.route + '/')\n return (\n <button\n key={child.id}\n onClick={() => {\n onNavigate(child.route)\n setOpen(false)\n }}\n className={cn(\n 'flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm transition-colors',\n isActive\n ? 'bg-muted font-medium text-foreground'\n : 'text-popover-foreground hover:bg-muted/70'\n )}\n >\n <ChildIcon className=\"h-4 w-4 text-muted-foreground\" />\n <span>{child.label}</span>\n </button>\n )\n })}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport function Topbar({\n navigation,\n logo,\n user,\n onMenuClick,\n hideMobileChrome,\n orgSwitcher,\n leftContent,\n rightContent,\n currentPath = '/',\n onNavigate,\n searchPlaceholder = 'Search...',\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n userMenuExtras,\n userMenuSlot,\n}: TopbarProps) {\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n\n const mainNav = navigation.filter((item) => item.section === 'main')\n const secondaryNav = navigation.filter((item) => item.section === 'secondary')\n const allNav = [...mainNav, ...secondaryNav]\n\n const handleNavigate = (route: string) => {\n onNavigate?.(route)\n }\n\n return (\n <header data-print=\"hide\" className=\"sticky top-0 z-50 w-full shrink-0\">\n {/* Row 1: Logo + Search + Actions */}\n <div className={cn('border-b border-sidebar-border bg-sidebar text-sidebar-foreground', hideMobileChrome && 'hidden md:block')}>\n <div className=\"flex h-14 w-full items-center justify-between px-4 md:px-6\">\n {/* Left: Mobile menu + workspace (ou o logo) — the hamburger is only\n rendered when an onMenuClick handler is supplied. Mobile-first apps\n with a bottom nav omit it so the bottom bar is the primary\n navigation.\n\n O canto esquerdo é o lugar de \"onde eu estou\": o seletor de\n workspace quando existe (o shell manda a marca do produto dentro\n dele, como ícone), senão o logo. O wordmark sozinho não respondia a\n pergunta — ele é o mesmo em toda conta. */}\n <div className=\"flex min-w-0 items-center gap-3\">\n {onMenuClick && (\n <button\n onClick={onMenuClick}\n className=\"inline-flex items-center justify-center rounded-md p-2 text-sidebar-foreground/70 hover:bg-sidebar/30 hover:text-sidebar-foreground md:hidden\"\n aria-label=\"Open menu\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n <div className=\"hidden min-w-0 shrink-0 items-center md:flex\">\n {orgSwitcher ?? logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n </div>\n\n {/* Center: Search (desktop only) */}\n <div className=\"mx-8 hidden max-w-sm flex-1 md:flex\">\n <button\n onClick={() => setCommandPaletteOpen(true)}\n className=\"relative flex h-8 w-full items-center rounded-md border border-sidebar-border bg-sidebar-accent px-3 pl-8 text-sm text-sidebar-muted shadow-sm transition-colors hover:border-sidebar-foreground/25 hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground\"\n >\n <Search className=\"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-sidebar-muted\" />\n <span className=\"text-xs\">{searchPlaceholder}</span>\n <kbd className=\"ml-auto hidden rounded border border-sidebar-border bg-sidebar-accent px-1.5 py-0.5 text-[10px] font-medium text-sidebar-muted sm:inline-block\">\n ⌘K\n </kbd>\n </button>\n </div>\n\n {/* Right: Actions — tarefas, avisos e conta. */}\n <div className=\"flex min-w-0 items-center gap-1\">\n {leftContent}\n {rightContent}\n {/* O menu do host quando existe — é o mesmo objeto do rail, com\n tema e idioma dentro. O daqui é o fallback para quem monta a\n Topbar sem shell. */}\n {userMenuSlot ?? (\n <TopbarUserMenu\n user={user}\n userPlan={userPlan}\n billingLabel={billingLabel}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userMenuExtras={userMenuExtras}\n />\n )}\n </div>\n </div>\n </div>\n\n {/* Row 2: Navigation — desktop only */}\n <div className=\"hidden md:block bg-sidebar\">\n <div className=\"flex h-11 w-full items-center px-4 md:px-6\">\n <nav ref={(el) => {\n if (!el) return\n const active = el.querySelector('[data-nav-active=\"true\"]') as HTMLElement\n if (active) {\n const left = active.offsetLeft - el.offsetWidth / 2 + active.offsetWidth / 2\n el.scrollTo({ left: Math.max(0, left), behavior: 'smooth' })\n }\n }} className=\"flex items-center gap-0.5 overflow-x-auto scrollbar-none\">\n {allNav.map((item) => {\n if (item.children && item.children.length > 0) {\n return (\n <NavDropdown\n key={item.id}\n item={item}\n currentPath={currentPath}\n onNavigate={handleNavigate}\n />\n )\n }\n\n const Icon = getIcon(item.icon)\n const isActive =\n item.route === '/'\n ? currentPath === '/'\n : currentPath === item.route || currentPath.startsWith(item.route + '/')\n\n return (\n <button\n key={item.id}\n data-nav-active={isActive || undefined}\n onClick={() => handleNavigate(item.route)}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors',\n isActive\n ? 'border-primary font-semibold text-sidebar-foreground'\n : 'border-transparent text-sidebar-muted hover:text-sidebar-foreground'\n )}\n >\n <Icon className=\"h-4 w-4\" />\n <span>{item.label}</span>\n {item.premium && (\n <Crown className=\"h-3 w-3 text-amber-500\" aria-hidden />\n )}\n {item.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {item.badge}\n </span>\n )}\n </button>\n )\n })}\n </nav>\n </div>\n </div>\n </header>\n )\n}\n","import * as React from 'react'\nimport {\n Menu,\n Home,\n Receipt,\n ArrowLeftRight,\n Calendar,\n CreditCard,\n Settings,\n MessageCircle,\n Wallet,\n PiggyBank,\n Plus,\n Sparkles,\n ArrowLeft,\n type LucideIcon,\n} from 'lucide-react'\nimport { Sidebar, type NavigationItem, type SidebarUser, type SidebarProps } from './Sidebar'\nimport { Topbar } from './Topbar'\nimport { SaveBar, SaveBarProvider } from './SaveBar'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { usePageHeaderClaimed, usePageTitleSlotHost, usePageHeaderHost, useHasPageHeaderOutlet, useHasPageActions, useHasPageHeaderBack } from '../stores/page-header.store'\nimport { PageHeaderCrumb } from '../primitives/page-header'\nimport { cn } from '../lib/cn'\nimport { ICON_MAP } from '../icons'\n\n// ---------------------------------------------------------------------------\n// Module header slot — the page top-bar exposes a DOM node that module pages\n// (ModulePage 'tabs' variant) portal their title + sub-nav into, so the module\n// header lives in the shell's top-of-page container (GoHighLevel style).\n// ---------------------------------------------------------------------------\n\nconst ModuleHeaderSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function useModuleHeaderSlot(): HTMLElement | null {\n return React.useContext(ModuleHeaderSlotContext)\n}\n\n// Right-aligned slot for a page's primary action buttons (e.g. \"New campaign\").\nconst ModuleHeaderActionsSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function useModuleHeaderActionsSlot(): HTMLElement | null {\n return React.useContext(ModuleHeaderActionsSlotContext)\n}\n\n// ---------------------------------------------------------------------------\n// A coluna de menu que ALGUMAS páginas trazem (as seções de um módulo, os links\n// de Configurações). Ela é entregue à shell em vez de desenhada no corpo, e a\n// shell a põe ANTES da barra de página: assim o menu encosta no topo do quadro\n// e a barra começa onde o conteúdo começa, em vez de atravessar por cima dos\n// dois e empurrar o menu para baixo do seu próprio título.\n// ---------------------------------------------------------------------------\nconst PageRailSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function usePageRailSlot(): HTMLElement | null {\n return React.useContext(PageRailSlotContext)\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface AppShellUser {\n fullName: string\n avatarUrl?: string\n email: string\n}\n\n// ---------------------------------------------------------------------------\n// Bottom-nav item model\n//\n// Four kinds share the mobile tab bar:\n// - route (default): a normal tab that navigates to `route`.\n// - action: a NON-route item rendered as a raised, elevated circular center\n// button (Mobills style). It fires `onBottomNavAction(id)` instead of\n// navigating — e.g. a global quick-add \"+\".\n// - more: opens the full navigation drawer. The shell owns this one, because\n// five slots can never hold a whole product: without it, every destination\n// outside the bar is unreachable on a phone.\n// - assistant: toggles the assistant rail. Also shell-owned — the corner FAB\n// stands down when a bar is present, so without this tab the assistant has\n// no entry point at all on mobile.\n// ---------------------------------------------------------------------------\n\nexport interface BottomNavRouteItem {\n kind?: 'route'\n label: string\n icon: string\n route: string\n}\n\nexport interface BottomNavActionItem {\n kind: 'action'\n /** Identifier passed to onBottomNavAction. */\n id: string\n icon: string\n /** Optional accessible label. */\n label?: string\n}\n\nexport interface BottomNavMoreItem {\n kind: 'more'\n label?: string\n icon?: string\n}\n\nexport interface BottomNavAssistantItem {\n kind: 'assistant'\n label?: string\n icon?: string\n}\n\nexport type BottomNavItem =\n | BottomNavRouteItem\n | BottomNavActionItem\n | BottomNavMoreItem\n | BottomNavAssistantItem\n\n/** True when the bar itself can reach the full navigation, which is what lets\n * the shell retire the hamburger without stranding a destination. */\nexport function bottomNavReachesAll(items?: BottomNavItem[]): boolean {\n return !!items?.some((i) => 'kind' in i && i.kind === 'more')\n}\n\n/** Mobile header treatment (small screens, <md). Desktop is unaffected.\n * - 'minimal' : a small top header bar (the default / today's behavior).\n * - 'transparent' : NO header bar; content is edge-to-edge with a floating\n * profile avatar pinned top-right (calls onProfile).\n * - 'hidden' : no header bar and no floating avatar. */\nexport type MobileHeaderVariant = 'transparent' | 'minimal' | 'hidden'\n\nexport interface AppShellProps {\n /** Layout variant */\n variant: 'sidebar' | 'topbar' | 'minimal'\n /** Wrap the main content in an inset framed card. The sidebar is always\n * flush/full-height (GoHighLevel style). */\n contentFrame?: boolean\n navigation?: NavigationItem[]\n /** Repassado ao rail: espera em esqueleto em vez de pintar uma lista curta. */\n navLoading?: boolean\n navError?: string | null\n navErrorLabel?: string\n navRetryLabel?: string\n onNavRetry?: () => void\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n /** Current-plan pill shown next to the user in the topbar menu. */\n userPlan?: { label: string; paid: boolean }\n /** i18n label for the billing/subscription user-menu item. */\n billingLabel?: string\n pageTitle?: string\n /**\n * Seta de voltar da barra, quando a ROTA declara um pai. É o caminho sem\n * código de página: `parentRoute` no manifesto e pronto. Uma página que\n * reivindica o slot (PageHeader) ganha desta — o cabeçalho dela sabe mais,\n * porque tem o dado carregado.\n */\n pageBack?: { onBack: () => void; label?: string }\n currentPath?: string\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n orgSwitcher?: React.ReactNode\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n sidebarTopContent?: React.ReactNode\n /** A conta atual, na linha logo abaixo do cabeçalho do rail. Ver `identity`\n * em Sidebar: no layout de topbar o equivalente vai em `orgSwitcher`. */\n sidebarIdentity?: React.ReactNode\n sidebarNavTop?: React.ReactNode\n /** Pinned row above the first destination — see Sidebar's `beforeNav`. */\n sidebarBeforeNav?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n bottomNav?: BottomNavItem[]\n /** Fired when a bottom-nav `action` item (e.g. the center \"+\") is tapped. */\n onBottomNavAction?: (id: string) => void\n /** Fired by the bottom bar's `assistant` tab. */\n onAssistantToggle?: () => void\n /** Drives the `assistant` tab's active state. */\n assistantOpen?: boolean\n /** Mobile header treatment (<md). Default: 'minimal'. Desktop unaffected. */\n mobileHeader?: MobileHeaderVariant\n /**\n * The page draws its own top bar, so the shell contributes none on desktop.\n * The card is untouched: its border and surface are what make the page and\n * the companion column read as one window.\n */\n immersive?: boolean\n /** O menu do usuário. No rail é a última linha da coluna; na topbar é o\n * avatar da direita. Um nó para os dois, para que trocar o layout do produto\n * não troque o que o menu oferece. */\n userMenuSlot?: React.ReactNode\n /** Row-shaped user menu for the mobile drawer. The topbar layout's own\n * `userMenuSlot` is an avatar built for the corner of a bar; the drawer needs\n * the same menu as a full-width row. Without it the drawer falls back to a\n * display-only row, which was invisible while the chrome row still carried\n * the real one and became the only — dead — user menu once it did not. */\n drawerUserMenuSlot?: React.ReactNode\n /** Rendered in sidebar bottom notification slot */\n notificationSlot?: React.ReactNode\n /** Unread notification count */\n unreadCount?: number\n /** Placeholder on the rail's search field. Translated by the shell. */\n searchLabel?: string\n /** Optional headings above the sidebar nav sections (contextual sidebars). */\n sidebarSectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** Identity of the current sidebar context — changing it animates the rail\n * swap as a push (new nav in, previous nav out). */\n sidebarNavKey?: string\n /** Push direction for a `sidebarNavKey` change. Default 'forward'. */\n sidebarNavDirection?: 'forward' | 'back'\n /** Render nav-group children as bare labels with an elbow marking the active\n * one, instead of an icon each. See Sidebar's `navChildConnector`. */\n sidebarNavChildConnector?: boolean\n /**\n * Full-height column pinned to the right (the assistant dock, a tasks\n * panel). Rendered as a flex SIBLING of the layout, so the app narrows to\n * make room instead of being covered — the difference between a split view\n * and a modal that happens to be tall.\n *\n * Falsy renders nothing and costs nothing: no wrapper, no divider, the\n * layout element stands alone exactly as before.\n */\n rightRail?: React.ReactNode\n /** Whether the rail is showing. Separate from `rightRail` so the column can\n * animate its width instead of snapping when it closes. */\n rightRailOpen?: boolean\n /** Starting width in px. Ignored once the user drags. Default 380. */\n defaultRightRailWidth?: number\n /** Fired after every drag so the host can persist the preference. */\n onRightRailWidthChange?: (width: number) => void\n /** Drag bounds in px. Defaults 300 / 720. */\n rightRailMinWidth?: number\n rightRailMaxWidth?: number\n /** Accessible name for the drag handle. */\n rightRailResizeLabel?: string\n}\n\n// ---------------------------------------------------------------------------\n// ShellPageTitle — o que a barra mostra quando NENHUMA página reivindicou o\n// slot: o título da rota/menu e, se a rota declarou um pai, o caminho de volta.\n//\n// Reusa o traço de `PageHeaderCrumb`, o mesmo que o componente `PageHeader`\n// usa. A seta tem que ser a MESMA seta, venha ela do manifesto ou da própria\n// página — dois desenhos foi exatamente o que este trabalho veio desfazer.\n// ---------------------------------------------------------------------------\n\nfunction ShellPageTitle({\n title,\n back,\n}: {\n title?: string\n back?: AppShellProps['pageBack']\n}) {\n if (!title && !back) return null\n return <PageHeaderCrumb title={title} parentLabel={back?.label} onBack={back?.onBack} headingLevel=\"h1\" />\n}\n\n// ---------------------------------------------------------------------------\n// Sidebar layout\n// ---------------------------------------------------------------------------\n\nfunction SidebarLayout({\n navigation = [],\n navLoading = false,\n navError,\n navErrorLabel,\n navRetryLabel,\n onNavRetry,\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userMenuExtras: _userMenuExtras,\n orgSwitcher,\n sidebarTopContent,\n sidebarIdentity,\n sidebarNavTop,\n sidebarBeforeNav,\n sidebarFooterContent,\n frame,\n immersive,\n currentPath,\n pageTitle,\n pageBack,\n topbarStart,\n topbarEnd,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel,\n hasBottomNav = false,\n barOwnsNav = false,\n mobileHeader = 'minimal',\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n railOpen,\n}: {\n navigation?: NavigationItem[]\n navLoading?: boolean\n navError?: string | null\n navErrorLabel?: string\n navRetryLabel?: string\n onNavRetry?: () => void\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userMenuExtras?: AppShellProps['userMenuExtras']\n orgSwitcher?: React.ReactNode\n sidebarTopContent?: React.ReactNode\n sidebarIdentity?: React.ReactNode\n sidebarNavTop?: React.ReactNode\n /** Pinned row above the first destination — see Sidebar's `beforeNav`. */\n sidebarBeforeNav?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n frame?: boolean\n immersive?: boolean\n currentPath?: string\n pageTitle?: string\n pageBack?: AppShellProps['pageBack']\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n userMenuSlot?: React.ReactNode\n notificationSlot?: React.ReactNode\n unreadCount?: number\n /** Placeholder on the rail's search field. Translated by the shell. */\n searchLabel?: string\n /** When a mobile bottom-nav bar is present, the mobile hamburger is\n * suppressed so the bottom nav is the primary mobile navigation. */\n hasBottomNav?: boolean\n /** The bar carries a \"Mais\" tab, so the hamburger is redundant. */\n barOwnsNav?: boolean\n /** Mobile header treatment (<md). Desktop keeps its top bar untouched. */\n mobileHeader?: MobileHeaderVariant\n sidebarSectionLabels?: AppShellProps['sidebarSectionLabels']\n sidebarNavKey?: string\n sidebarNavDirection?: 'forward' | 'back'\n sidebarNavChildConnector?: boolean\n /** A companion rail is open to the right of the content. The content card\n * then opens its right edge so the two share one surface and one seam. */\n railOpen?: boolean\n}) {\n const sidebarCollapsed = useLayoutStore((s) => s.sidebarCollapsed)\n const pageHeaderClaimed = usePageHeaderClaimed()\n const setTitleSlot = usePageTitleSlotHost()\n // Declara que ESTA shell mostra o slot — é o que deixa PageHeader saber que\n // pode entregar o cabeçalho para a barra em vez de desenhá-lo no corpo.\n usePageHeaderHost()\n const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed)\n // Drawer state lives in the store, not locally: the bottom bar's \"Mais\"\n // tab is rendered by the parent shell and has to open this same drawer.\n const mobileMenuOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileMenuOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n const [headerSlot, setHeaderSlot] = React.useState<HTMLElement | null>(null)\n const [actionsSlot, setActionsSlot] = React.useState<HTMLElement | null>(null)\n const [pageRailSlot, setPageRailSlot] = React.useState<HTMLElement | null>(null)\n const hasPageActions = useHasPageActions()\n\n return (\n <SaveBarProvider>\n <ModuleHeaderSlotContext.Provider value={headerSlot}>\n <ModuleHeaderActionsSlotContext.Provider value={actionsSlot}>\n <PageRailSlotContext.Provider value={pageRailSlot}>\n <div className={cn(\n 'shell-enter fz-viewport-h flex overflow-hidden bg-background',\n hasBottomNav && 'fz-has-bottom-bar',\n // Frame mode: the inset gap around the framed card takes the sidebar (menu)\n // color, so the white card reads as a panel floating on the same tone as the\n // left menu. The card's own md:m-2 margin reveals this behind it.\n frame && 'md:bg-sidebar',\n )}>\n {/* Desktop Sidebar — always flush / full-height (GoHighLevel style) */}\n <div className=\"hidden md:flex\">\n <Sidebar\n navigation={navigation}\n navLoading={navLoading}\n navError={navError}\n navErrorLabel={navErrorLabel}\n navRetryLabel={navRetryLabel}\n onNavRetry={onNavRetry}\n logo={logo}\n collapsed={sidebarCollapsed}\n onToggle={() => setSidebarCollapsed(!sidebarCollapsed)}\n onNavigate={onNavigate}\n currentPath={currentPath}\n user={user}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n topContent={sidebarTopContent}\n identity={sidebarIdentity}\n navTop={sidebarNavTop}\n beforeNav={sidebarBeforeNav}\n footerContent={sidebarFooterContent}\n // Framed shells already draw the rail's edge — twice over. The inset\n // gap around the card is painted in the SIDEBAR's own colour (see the\n // `md:bg-sidebar` above), so the rail's right border ends up as a\n // hairline inside a solid field of its own tone, a couple of pixels\n // from the card's real border: two lines stating one boundary. The\n // internal separators (under the logo, above the settings block and\n // the footer) read the same way — rules ruled across a slab that is\n // already visibly a slab.\n //\n // Unframed shells keep them: there the rail meets the content with no\n // gap and no card edge, and the border IS the boundary.\n borderless={frame}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n sectionLabels={sidebarSectionLabels}\n navKey={sidebarNavKey}\n navDirection={sidebarNavDirection}\n navChildConnector={sidebarNavChildConnector}\n />\n </div>\n\n {/* Main content — the top bar, then the inset framed card UNDER it.\n The inset/rounding is suppressed on mobile so the content stays\n edge-to-edge (the framed card only reads well on larger screens). */}\n <div className=\"relative flex min-w-0 flex-1 flex-col overflow-hidden\">\n {/* Top bar — mobile hamburger + module header slot (title + sub-nav) + actions.\n On mobile the bar is suppressed for the 'transparent' / 'hidden' header\n treatments (content goes edge-to-edge); desktop keeps it always. The\n portal targets below stay mounted (display:none on mobile) so module\n pages can still portal their sub-nav on desktop without crashing. */}\n {/* Emoldurado, a barra corre POR FORA do cartão, sobre a moldura — que\n é pintada na cor do menu (o `md:bg-sidebar` da raiz da shell). Com\n isso o topo do menu e a barra da página viram UMA faixa só de ponta\n a ponta, e o cartão do conteúdo passa a arredondar por baixo dela,\n em vez de o arredondamento começar no alto da tela e a faixa escura\n terminar no meio do caminho.\n Sem moldura ela continua sem superfície própria, tomando o que a\n coluna pinta — pintá-la de `card` sobre uma página sem moldura fazia\n uma tira mais clara atravessando o topo, lida como um widget posto\n sobre o conteúdo; a linha embaixo é o que separa. */}\n <div className={cn(\n 'flex shrink-0 items-center justify-between gap-3 px-4 py-2',\n 'min-h-14 border-b border-border',\n // Sobre a moldura, os tokens do menu. O que a barra mostra (título,\n // abas do módulo, botões) é escrito com `foreground`/`border`/`muted`\n // comuns: num app de menu escuro isso seria texto escuro sobre preto.\n // Remapear as variáveis aqui converte a barra inteira de uma vez, sem\n // cada página saber em que superfície caiu. A linha de baixo sai: a\n // borda de cima do cartão já é a costura.\n // Altura TRAVADA em 56px na moldura, não mínima: esta faixa e a do\n // assistente são desenhadas em subárvores diferentes, e o que alinha\n // o topo dos dois cartões é as duas terem exatamente a mesma altura.\n // Com `min-h` bastava um controle mais alto de um lado para o cartão\n // daquele lado descer sozinho.\n frame && 'fz-on-band md:h-14 md:border-b-0 md:text-sidebar-foreground md:[--accent-foreground:var(--sidebar-accent-foreground)] md:[--accent:var(--sidebar-accent)] md:[--background:var(--sidebar)] md:[--border:var(--sidebar-border)] md:[--card:var(--sidebar)] md:[--foreground:var(--sidebar-foreground)] md:[--muted-foreground:var(--sidebar-muted)] md:[--muted:var(--sidebar-accent)]',\n // …unless the page put its actions in it. Hiding the bar on mobile\n // used to hide the only \"Novo\" the screen had.\n mobileHeader !== 'minimal' && !hasPageActions && 'hidden md:flex',\n // Immersive pages draw their own window bar. Keeping ours would be two\n // bars stating one thing — but only on desktop: on a phone this band\n // is where the hamburger lives, and the page's bar sits under it.\n immersive && 'md:hidden',\n )}>\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {/* Mobile hamburger — suppressed when a bottom-nav bar owns mobile\n navigation (mobile-first apps). Desktop sidebar is untouched. */}\n {!barOwnsNav && (\n <button\n onClick={() => setMobileMenuOpen(true)}\n className=\"inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-accent md:hidden\"\n aria-label=\"Open menu\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n {/* A sub-page (form, detail) claims this slot with its own back\n link / breadcrumb — it already says where you are, and printing\n the section title above it spent a whole row repeating a word. */}\n {/* The page draws its own header INTO this element, from its own\n tree. The shell only names the screen when nobody claimed it. */}\n {!pageHeaderClaimed && <ShellPageTitle title={pageTitle} back={pageBack} />}\n <div ref={setTitleSlot} className=\"flex min-w-0 items-center empty:hidden\" />\n {topbarStart}\n {/* Module pages (tabs variant) portal their sub-nav here */}\n <div ref={setHeaderSlot} className=\"flex min-w-0 flex-1 items-center\" />\n </div>\n {/* `flex-1` só a partir de md, onde existe a busca no meio para os dois\n lados equilibrarem. No celular a busca não é desenhada, e um lado\n direito reivindicando metade da barra roubava essa metade do\n TÍTULO — um breadcrumb como \"← Relatórios / DRE —…\" truncava com\n meia tela vazia ao lado. Abaixo de md ele ocupa o que os botões\n pedem, e o resto é do nome da tela. */}\n <div className=\"flex min-w-0 shrink-0 items-center justify-end gap-2 md:flex-1\">\n {/* Pages portal their primary action buttons here */}\n {/* O que cai aqui é pintado pela cor da FAIXA, não pela do papel.\n A barra é da cor do trilho; um botão `bg-primary` de uma marca\n escura nasce preto sobre preto. `--primary-on-rail` é a mesma\n marca quando ela lê bem aqui, e a tinta do item ativo do trilho\n quando não — ver `railSafePrimary`. */}\n <div ref={setActionsSlot} className=\"flex items-center gap-2\" style={{ '--primary': 'var(--primary-on-rail)', '--primary-foreground': 'var(--primary-on-rail-foreground)' } as React.CSSProperties} />\n {topbarEnd}\n </div>\n </div>\n\n {/* O cartão do conteúdo, agora ABAIXO da barra: o arredondamento do\n topo encosta na faixa escura em vez de começar junto com ela.\n A trilha da página (PageRail) mora dentro dele — a barra passa por\n cima das duas, que é o que faz dela uma faixa inteira. */}\n <div data-frame={frame || undefined} className={cn(\n 'relative flex min-w-0 flex-1 overflow-hidden',\n // `content`, not `card`: this is the page's own surface, and cards have\n // to sit ON it. Painted card, the frame was the same tone as everything\n // inside it and the page read as one flat sheet.\n 'fz-page-surface',\n frame && 'md:mb-2 md:ml-2 md:rounded-xl md:border md:border-border md:bg-content',\n // Sem barra no desktop (páginas imersivas desenham a sua) o cartão\n // ficaria colado no alto da janela: a folga de cima volta.\n frame && immersive && 'md:mt-2',\n // With a companion rail open, the page and the rail are ONE card: the\n // right edge opens and the rail closes it. Two cards with a strip of\n // chrome between them made the assistant read as a separate window\n // parked next to the app rather than as a column of it — the rail's own\n // left border is then the single seam between the two.\n frame && (railOpen ? 'md:rounded-r-none md:border-r-0' : 'md:mr-2'),\n immersive && 'md:overflow-hidden',\n )}>\n {/* The page's own menu column, when it has one — see PageRail. Empty on\n every other screen, and an empty div is zero wide. */}\n <div ref={setPageRailSlot} className=\"flex shrink-0 empty:hidden\" />\n <div className=\"relative flex min-w-0 flex-1 flex-col overflow-hidden\">\n {/* Page content */}\n <main className=\"min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </main>\n\n {/* App-wide floating SaveBar (spans the content column, not the sidebar) */}\n <SaveBar />\n </div>\n </div>\n </div>\n\n {/* Mobile drawer — animated, owns its own close transition. */}\n {mobileMenuOpen && (\n <MobileOverlay\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n topContent={sidebarTopContent}\n identity={sidebarIdentity}\n navTop={sidebarNavTop}\n beforeNav={sidebarBeforeNav}\n footerContent={sidebarFooterContent}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n onClose={() => setMobileMenuOpen(false)}\n />\n )}\n </div>\n </PageRailSlotContext.Provider>\n </ModuleHeaderActionsSlotContext.Provider>\n </ModuleHeaderSlotContext.Provider>\n </SaveBarProvider>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Topbar layout\n// ---------------------------------------------------------------------------\n\nfunction TopbarLayout({\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n userMenuExtras,\n userMenuSlot,\n drawerUserMenuSlot,\n orgSwitcher,\n frame,\n currentPath,\n topbarStart,\n topbarEnd,\n pageTitle,\n pageBack,\n notificationSlot,\n unreadCount = 0,\n hasBottomNav = false,\n barOwnsNav = false,\n}: {\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userPlan?: AppShellProps['userPlan']\n billingLabel?: AppShellProps['billingLabel']\n userMenuExtras?: AppShellProps['userMenuExtras']\n /** O menu do usuário do host — o mesmo nó que o rail recebe. */\n userMenuSlot?: React.ReactNode\n drawerUserMenuSlot?: React.ReactNode\n /** Workspace switcher — rendered with the right-side actions (desktop) and in the mobile drawer. */\n orgSwitcher?: React.ReactNode\n frame?: boolean\n currentPath?: string\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n pageTitle?: string\n pageBack?: AppShellProps['pageBack']\n /** Bell/inbox slot — in the topbar layout it renders with the right-side actions. */\n notificationSlot?: React.ReactNode\n unreadCount?: number\n /** When a mobile bottom-nav bar is present, the mobile hamburger is\n * suppressed so the bottom nav is the primary mobile navigation. */\n hasBottomNav?: boolean\n /** The bar carries a \"Mais\" tab, so the hamburger is redundant. */\n barOwnsNav?: boolean\n}) {\n // Drawer state lives in the store, not locally: the bottom bar's \"Mais\"\n // tab is rendered by the parent shell and has to open this same drawer.\n const mobileMenuOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileMenuOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n const [headerSlot, setHeaderSlot] = React.useState<HTMLElement | null>(null)\n const [actionsSlot, setActionsSlot] = React.useState<HTMLElement | null>(null)\n const [pageRailSlot, setPageRailSlot] = React.useState<HTMLElement | null>(null)\n const rawClaimed = usePageHeaderClaimed()\n const setTitleSlot = usePageTitleSlotHost()\n const hasOutlet = useHasPageHeaderOutlet()\n const hasPageActions = useHasPageActions()\n usePageHeaderHost()\n // Um outlet mais fundo (a coluna de conteúdo de um módulo com trilha) já\n // desenha o cabeçalho no lugar certo — a barra larga aqui seria a segunda.\n const pageHeaderClaimed = hasOutlet ? false : rawClaimed\n\n // Same page title the sidebar layout draws. The horizontal nav marks the\n // GROUP (\"Registry\"), not the screen (\"Categories\").\n const showTitle = !hasOutlet && !!pageTitle\n\n // Topbar is full-bleed (edge to edge); only the content area gets the frame.\n return (\n <SaveBarProvider>\n <ModuleHeaderSlotContext.Provider value={headerSlot}>\n <ModuleHeaderActionsSlotContext.Provider value={actionsSlot}>\n <PageRailSlotContext.Provider value={pageRailSlot}>\n <div className={cn('shell-enter fz-viewport-h relative flex flex-col overflow-hidden bg-background', hasBottomNav && 'fz-has-bottom-bar')}>\n <Topbar\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userPlan={userPlan}\n billingLabel={billingLabel}\n userMenuExtras={userMenuExtras}\n userMenuSlot={userMenuSlot}\n orgSwitcher={orgSwitcher}\n leftContent={topbarStart}\n rightContent={(topbarEnd || notificationSlot) ? <>{topbarEnd}{notificationSlot}</> : undefined}\n onMenuClick={barOwnsNav ? undefined : () => setMobileMenuOpen(true)}\n hideMobileChrome={barOwnsNav}\n />\n {/* Frame inset/border only from md up, so mobile stays edge-to-edge. The\n inset gap behind the framed card is the header color (bg-sidebar), so the\n white card reads as a panel floating on the same navy as the topbar. */}\n {/* The frame is fixed to the viewport and the content scrolls INSIDE it,\n mirroring SidebarLayout. With `main` as the scroller the card grew with\n the page and its bottom edge rode off-screen. */}\n <main className={cn('flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden', frame && 'md:bg-sidebar md:p-2')}>\n <div data-frame={frame || undefined} className={cn('fz-page-surface flex min-w-0 min-h-0 flex-1 overflow-hidden', frame && 'md:rounded-xl md:border md:border-border md:bg-content')}>\n {/* The page's own menu column, when it has one — see PageRail. */}\n <div ref={setPageRailSlot} className=\"flex shrink-0 empty:hidden\" />\n <div className=\"flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden\">\n {/* Page header — a barra só existe quando tem o que a navegação de topo\n não tem: ações, ou o \"← voltar\" de uma subpágina. O nome da tela\n sozinho não paga a linha AQUI, porque o menu horizontal logo acima\n já marca em qual item você está — \"Painel\" ficava escrito duas\n vezes, uma sob a outra, antes de qualquer conteúdo. (No layout de\n sidebar a barra fica: lá o menu é uma coluna e a barra é a única\n superfície que nomeia a tela.) */}\n {/* On a phone the horizontal nav row above is hidden, so nothing else\n names the screen — the reason this bar was optional only holds on\n desktop. It renders always and hides itself from md up when the\n title is all it would carry. */}\n {(pageHeaderClaimed || pageBack || hasPageActions || barOwnsNav) && (\n <div\n className={cn(\n 'flex min-h-12 shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-2',\n !(pageHeaderClaimed || pageBack || hasPageActions) && 'md:hidden',\n )}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {!pageHeaderClaimed && <ShellPageTitle title={showTitle ? pageTitle : undefined} back={pageBack} />}\n <div ref={setTitleSlot} className=\"flex min-w-0 items-center empty:hidden\" />\n <div ref={setHeaderSlot} className=\"flex min-w-0 flex-1 items-center\" />\n </div>\n {/* O que cai aqui é pintado pela cor da FAIXA, não pela do papel.\n A barra é da cor do trilho; um botão `bg-primary` de uma marca\n escura nasce preto sobre preto. `--primary-on-rail` é a mesma\n marca quando ela lê bem aqui, e a tinta do item ativo do trilho\n quando não — ver `railSafePrimary`. */}\n <div ref={setActionsSlot} className=\"flex shrink-0 items-center gap-2\" style={{ '--primary': 'var(--primary-on-rail)', '--primary-foreground': 'var(--primary-on-rail-foreground)' } as React.CSSProperties} />\n </div>\n )}\n <div className=\"min-h-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </div>\n </div>\n </div>\n </main>\n\n {/* App-wide floating SaveBar */}\n <SaveBar />\n\n {/* Mobile drawer — topbar has no persistent sidebar, so the burger opens\n the same animated nav drawer used by the sidebar layout. */}\n {mobileMenuOpen && (\n <MobileOverlay\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n userMenuSlot={drawerUserMenuSlot ?? (user ? <DrawerUserRow user={user} /> : undefined)}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n onClose={() => setMobileMenuOpen(false)}\n />\n )}\n </div>\n </PageRailSlotContext.Provider>\n </ModuleHeaderActionsSlotContext.Provider>\n </ModuleHeaderSlotContext.Provider>\n </SaveBarProvider>\n )\n}\n\n// Compact user identity for the mobile drawer's bottom row.\nfunction DrawerUserRow({ user }: { user: AppShellUser }) {\n const label = user.fullName || user.email\n return (\n <div className=\"flex min-w-0 items-center gap-2 px-1\">\n {user.avatarUrl ? (\n <img src={user.avatarUrl} alt=\"\" className=\"h-7 w-7 shrink-0 rounded-full object-cover\" />\n ) : (\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-semibold text-primary-foreground\">\n {(label || '?').charAt(0).toUpperCase()}\n </span>\n )}\n <span className=\"truncate text-sm font-medium text-sidebar-foreground\">{label}</span>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Minimal layout\n// ---------------------------------------------------------------------------\n\nfunction MinimalLayout({\n logo,\n user: _user,\n children,\n headerEnd,\n hasBottomNav = false,\n}: {\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n headerEnd?: React.ReactNode\n hasBottomNav?: boolean\n}) {\n return (\n <div className={cn('shell-enter fz-viewport-h flex flex-col', hasBottomNav && 'fz-has-bottom-bar')}>\n <header className=\"flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 md:px-6\">\n {/* `logo === null` = esta casa não é marcada pelo produto (ver Sidebar). */}\n {logo === null ? null : (\n <div className=\"flex items-center gap-3\">\n {logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n )}\n {headerEnd && <div className=\"flex items-center gap-2\">{headerEnd}</div>}\n </header>\n <main className=\"min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </main>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Mobile overlay drawer\n// ---------------------------------------------------------------------------\n\ntype MobileOverlayProps = Omit<SidebarProps, 'collapsed' | 'onToggle'> & {\n onClose: () => void\n}\n\nfunction MobileOverlay({ onClose, onNavigate, ...sidebarProps }: MobileOverlayProps) {\n // Mount hidden, then flip to visible on the next frame so the CSS transition\n // plays on open. On dismiss we play the exit transition first, then unmount.\n const [visible, setVisible] = React.useState(false)\n\n React.useEffect(() => {\n const id = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(id)\n }, [])\n\n const close = React.useCallback(() => {\n setVisible(false)\n window.setTimeout(onClose, 250)\n }, [onClose])\n\n // Lock body scroll while the drawer is open.\n React.useEffect(() => {\n const previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n return () => {\n document.body.style.overflow = previous\n }\n }, [])\n\n // Dismiss on Escape.\n React.useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') close()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [close])\n\n return (\n <div className=\"fixed inset-0 z-[60] md:hidden\">\n {/* Backdrop — fades in/out */}\n <div\n className={cn(\n 'absolute inset-0 bg-black/50 transition-opacity duration-300 ease-out',\n visible ? 'opacity-100' : 'opacity-0',\n )}\n onClick={close}\n />\n {/* Drawer — slides in from the left, reusing the real Sidebar for full\n design parity (icons, active state, org switcher, bottom user row). */}\n <div\n className={cn(\n 'absolute inset-y-0 left-0 shadow-2xl transition-transform duration-300 ease-out will-change-transform',\n visible ? 'translate-x-0' : '-translate-x-full',\n )}\n >\n <Sidebar\n {...sidebarProps}\n // Clicar na saída de contexto troca o trilho e a gaveta FICA. Armado\n // aqui e não no botão porque `navTop` é um nó do app: a gaveta é que\n // sabe que está aberta, o botão não.\n navTop={sidebarProps.navTop ? (\n <div onClickCapture={() => useLayoutStore.getState().keepDrawerOpenOnce()}>\n {sidebarProps.navTop}\n </div>\n ) : undefined}\n collapsed={false}\n onToggle={close}\n drawer\n borderless\n onNavigate={(route) => {\n onNavigate?.(route)\n close()\n }}\n />\n </div>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Mobile bottom tab bar — rendered for every variant on small screens.\n// ui must NOT import from saas, so the icon lookup is a small local map (a\n// mirror of the saas icon convention). Unknown icon names fall back to Home.\n// ---------------------------------------------------------------------------\n\n// The bar used to carry its own 11-entry icon map while the sidebar read the\n// full registry, so any other icon name silently degraded to a house.\nconst bottomNavIcon = (name?: string, fallback: LucideIcon = Home): LucideIcon =>\n (name ? ICON_MAP[name] : undefined) ?? fallback\n\n// Floating profile avatar — mobile-only (md:hidden), pinned top-right over the\n// content. Used with the 'transparent' mobile header treatment so there is no\n// header bar but the user still has a one-tap route into their profile.\nfunction FloatingProfileAvatar({ user, onClick }: { user?: AppShellUser; onClick?: () => void }) {\n if (!user) return null\n const label = user.fullName || user.email\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-label=\"Profile\"\n className=\"fixed right-3 top-3 z-40 md:hidden\"\n >\n {user.avatarUrl ? (\n <img\n src={user.avatarUrl}\n alt=\"\"\n className=\"h-9 w-9 rounded-full object-cover shadow-md ring-2 ring-background\"\n />\n ) : (\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-primary text-sm font-semibold text-primary-foreground shadow-md ring-2 ring-background\">\n {(label || '?').charAt(0).toUpperCase()}\n </span>\n )}\n </button>\n )\n}\n\nfunction MobileBottomNav({\n items,\n currentPath,\n onNavigate,\n onAction,\n onMore,\n onAssistant,\n assistantOpen,\n moreOpen,\n retracted,\n}: {\n items: NonNullable<AppShellProps['bottomNav']>\n currentPath?: string\n onNavigate?: (route: string) => void\n onAction?: (id: string) => void\n onMore?: () => void\n onAssistant?: () => void\n assistantOpen?: boolean\n moreOpen?: boolean\n retracted?: boolean\n}) {\n const path = currentPath ?? ''\n\n // The bar is the last thing above the home indicator, so it pads itself out\n // of the inset rather than sitting under it. min-h keeps the 64px bar height\n // while the padding grows the element on devices that have an inset.\n return (\n <nav\n aria-label=\"Navegação principal\"\n aria-hidden={retracted || undefined}\n className={cn(\n 'fz-safe-b fixed inset-x-0 bottom-0 z-50 flex min-h-16 items-stretch justify-around border-t border-border bg-background md:hidden',\n 'motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out',\n retracted && 'pointer-events-none translate-y-full',\n )}\n >\n {items.map((item, i) => {\n // Elevated center ACTION button (Mobills style) — raised above the bar,\n // circular, primary-filled; fires onBottomNavAction instead of routing.\n if ('kind' in item && item.kind === 'action') {\n const ActionIcon = bottomNavIcon(item.icon, Plus)\n return (\n <div key={item.id} className=\"flex flex-1 items-start justify-center\">\n <button\n type=\"button\"\n onClick={() => onAction?.(item.id)}\n aria-label={item.label ?? 'Add'}\n className=\"-mt-6 flex h-14 w-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/30 ring-4 ring-background transition-transform active:scale-95\"\n >\n <ActionIcon className=\"h-6 w-6\" />\n </button>\n </div>\n )\n }\n\n const isMore = 'kind' in item && item.kind === 'more'\n const isAssistant = 'kind' in item && item.kind === 'assistant'\n\n const label = isMore\n ? (item.label ?? 'Mais')\n : isAssistant\n ? (item.label ?? 'IA')\n : (item as BottomNavRouteItem).label\n\n const Icon = bottomNavIcon(\n item.icon,\n isMore ? Menu : isAssistant ? Sparkles : Home,\n )\n\n const route = isMore || isAssistant ? undefined : (item as BottomNavRouteItem).route\n const isActive = isMore\n ? !!moreOpen\n : isAssistant\n ? !!assistantOpen\n : route === '/'\n ? path === '/' || path === ''\n : !!route && (path === route || path.startsWith(route + '/'))\n\n return (\n <button\n key={isMore ? 'more' : isAssistant ? 'assistant' : `${route}-${i}`}\n type=\"button\"\n onClick={() => (isMore ? onMore?.() : isAssistant ? onAssistant?.() : onNavigate?.(route!))}\n aria-current={isActive && route ? 'page' : undefined}\n aria-expanded={isMore || isAssistant ? isActive : undefined}\n className={cn(\n // min-h-[44px] is the floor a finger needs; the bar was letting\n // content decide and landing around 40.\n 'relative flex min-h-[44px] flex-1 flex-col items-center justify-center gap-0.5 px-1 py-2 transition-colors',\n isActive ? 'text-primary' : 'text-muted-foreground',\n )}\n >\n {/* Colour alone is not a state indicator — the bar carries a rule\n above the active tab so the current place survives a glance. */}\n <span\n aria-hidden\n className={cn(\n 'absolute inset-x-3 top-0 h-0.5 rounded-full transition-opacity',\n isActive ? 'bg-primary opacity-100' : 'opacity-0',\n )}\n />\n <Icon className=\"h-5 w-5 shrink-0\" />\n <span className=\"max-w-full truncate text-[11px] leading-tight\">{label}</span>\n </button>\n )\n })}\n </nav>\n )\n}\n\n// ---------------------------------------------------------------------------\n// AppShell — main entry point\n// ---------------------------------------------------------------------------\n\nexport function AppShell({\n variant,\n contentFrame,\n navigation = [],\n // Declarados em AppShellProps desde sempre e nunca desestruturados aqui: o\n // esqueleto do rail so existia no caminho que nao e o que o app usa.\n navLoading = false,\n navError = null,\n navErrorLabel,\n navRetryLabel,\n onNavRetry,\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n pageTitle,\n pageBack,\n currentPath,\n userMenuExtras,\n orgSwitcher,\n topbarStart,\n topbarEnd,\n sidebarTopContent,\n sidebarIdentity,\n sidebarNavTop,\n sidebarBeforeNav,\n sidebarFooterContent,\n bottomNav,\n onBottomNavAction,\n onAssistantToggle,\n assistantOpen,\n mobileHeader = 'minimal',\n immersive = false,\n userMenuSlot,\n drawerUserMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel,\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n rightRail,\n rightRailOpen = true,\n defaultRightRailWidth,\n onRightRailWidthChange,\n rightRailMinWidth,\n rightRailMaxWidth,\n rightRailResizeLabel,\n}: AppShellProps) {\n const hasBottomNav = !!bottomNav?.length\n const barOwnsNav = bottomNavReachesAll(bottomNav)\n // A screen with a back affordance is somewhere the user went ON PURPOSE — a\n // form, a settings tab, a record. Top-level tabs are not the way out of it,\n // the back arrow is, and a phone has too little height to spend 64px on a\n // control that does not apply. The bar slides away and comes back on the way\n // out. `--fz-bottom-bar` goes with it, so the save bar drops down to meet it.\n // Two sources say \"you are one level down\": the route's own parent (settings\n // tabs) and a page that claimed the header with a back (a form reached from a\n // module tab). The module tab band already steps aside on the second one —\n // the bar reads the same signal rather than inventing a third.\n const pageClaimedBack = useHasPageHeaderBack()\n const barRetracted = !!pageBack || pageClaimedBack\n const mobileDrawerOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileDrawerOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n\n // Going anywhere closes the drawer. Nav items already closed it themselves,\n // but the user menu inside it (Perfil, Configurações, Assinatura) navigates\n // through its own handlers and left the drawer standing over the screen it\n // had just opened. Keyed on the route rather than on each control, so the\n // next thing added in there does not have to remember.\n React.useEffect(() => {\n // …a menos que o que navegou tenha sido a saída de contexto do próprio\n // menu (\"← Voltar para o início\"), que troca o trilho em vez de levar a\n // algum lugar. Ver drawerKeepOpenOnce na store.\n if (useLayoutStore.getState().drawerKeepOpenOnce) {\n useLayoutStore.setState({ drawerKeepOpenOnce: false })\n return\n }\n setMobileDrawerOpen(false)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentPath])\n const bottomBar = hasBottomNav ? (\n <MobileBottomNav\n items={bottomNav!}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onAction={onBottomNavAction}\n onMore={() => setMobileDrawerOpen(!mobileDrawerOpen)}\n moreOpen={mobileDrawerOpen}\n onAssistant={onAssistantToggle}\n assistantOpen={assistantOpen}\n retracted={barRetracted}\n />\n ) : null\n // Transparent mobile header → no bar, a floating avatar top-right instead.\n const floatingAvatar =\n mobileHeader === 'transparent' && user ? (\n <FloatingProfileAvatar user={user} onClick={onProfile} />\n ) : null\n\n let layoutElement: React.ReactNode\n switch (variant) {\n case 'sidebar':\n layoutElement = (\n <SidebarLayout\n navigation={navigation}\n // O estado de espera do rail SO existia no caminho de cima: este\n // branch repassava trinta props e deixava estas cinco para tras, e\n // como e ele que o app usa, o esqueleto nunca chegava a montar.\n navLoading={navLoading}\n navError={navError}\n navErrorLabel={navErrorLabel}\n navRetryLabel={navRetryLabel}\n onNavRetry={onNavRetry}\n logo={logo}\n user={user}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userMenuExtras={userMenuExtras}\n orgSwitcher={orgSwitcher}\n sidebarTopContent={sidebarTopContent}\n sidebarIdentity={sidebarIdentity}\n sidebarNavTop={sidebarNavTop}\n sidebarBeforeNav={sidebarBeforeNav}\n sidebarFooterContent={sidebarFooterContent}\n frame={contentFrame}\n immersive={immersive}\n currentPath={currentPath}\n pageTitle={pageTitle}\n pageBack={pageBack}\n topbarStart={topbarStart}\n topbarEnd={topbarEnd}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n hasBottomNav={hasBottomNav && !barRetracted}\n barOwnsNav={barOwnsNav}\n mobileHeader={mobileHeader}\n sidebarSectionLabels={sidebarSectionLabels}\n sidebarNavKey={sidebarNavKey}\n sidebarNavDirection={sidebarNavDirection}\n sidebarNavChildConnector={sidebarNavChildConnector}\n railOpen={!!rightRail && rightRailOpen}\n >\n {children}\n </SidebarLayout>\n )\n break\n\n case 'topbar':\n layoutElement = (\n <TopbarLayout\n navigation={navigation}\n logo={logo}\n user={user}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userPlan={userPlan}\n billingLabel={billingLabel}\n userMenuExtras={userMenuExtras}\n userMenuSlot={userMenuSlot}\n drawerUserMenuSlot={drawerUserMenuSlot}\n orgSwitcher={orgSwitcher}\n frame={contentFrame}\n currentPath={currentPath}\n topbarStart={topbarStart}\n topbarEnd={topbarEnd}\n pageTitle={pageTitle}\n pageBack={pageBack}\n notificationSlot={notificationSlot}\n hasBottomNav={hasBottomNav && !barRetracted}\n barOwnsNav={barOwnsNav}\n >\n {children}\n </TopbarLayout>\n )\n break\n\n case 'minimal':\n layoutElement = (\n <MinimalLayout logo={logo} user={user} headerEnd={topbarEnd} hasBottomNav={hasBottomNav && !barRetracted}>\n {children}\n </MinimalLayout>\n )\n break\n\n default: {\n const _exhaustive: never = variant\n return null\n }\n }\n\n return (\n <>\n {rightRail ? (\n <SplitWithRightRail\n rail={rightRail}\n open={rightRailOpen}\n frame={contentFrame}\n defaultWidth={defaultRightRailWidth}\n onWidthChange={onRightRailWidthChange}\n minWidth={rightRailMinWidth}\n maxWidth={rightRailMaxWidth}\n resizeLabel={rightRailResizeLabel}\n >\n {layoutElement}\n </SplitWithRightRail>\n ) : (\n layoutElement\n )}\n {floatingAvatar}\n {bottomBar}\n </>\n )\n}\n\n// ---------------------------------------------------------------------------\n// SplitWithRightRail — the app on the left, a full-height rail on the right,\n// a divider the user owns between them.\n//\n// The layouts all root at `h-screen overflow-hidden`, so putting them in a\n// `flex-1 min-w-0` cell keeps their height and lets them shrink. `min-w-0` is\n// load-bearing: without it a flex child refuses to go below its content width\n// and the rail gets pushed off-screen instead of the content reflowing.\n// ---------------------------------------------------------------------------\n\nfunction SplitWithRightRail({\n children,\n rail,\n open,\n frame,\n defaultWidth = 380,\n onWidthChange,\n minWidth = 300,\n maxWidth = 720,\n resizeLabel = 'Resize panel',\n}: {\n children: React.ReactNode\n rail: React.ReactNode\n open: boolean\n /** Frame mode: the gutter between content and rail takes the sidebar tone,\n * the same surface the content card floats on. Without this the split shows\n * a bare strip of page background and the rail reads as bolted on. */\n frame?: boolean\n defaultWidth?: number\n onWidthChange?: (width: number) => void\n minWidth?: number\n maxWidth?: number\n resizeLabel?: string\n}) {\n const [width, setWidth] = React.useState(defaultWidth)\n const [dragging, setDragging] = React.useState(false)\n\n const clamp = React.useCallback(\n (value: number) => Math.min(maxWidth, Math.max(minWidth, value)),\n [minWidth, maxWidth],\n )\n\n // The app follows the pointer to the pixel, so the drag runs on window\n // listeners rather than on the handle: the cursor routinely outruns a 6px\n // target, and a resize that stops when you move too fast feels broken.\n React.useEffect(() => {\n if (!dragging) return\n const onMove = (event: PointerEvent) => {\n event.preventDefault()\n setWidth(clamp(window.innerWidth - event.clientX))\n }\n const stop = () => setDragging(false)\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', stop)\n window.addEventListener('pointercancel', stop)\n // Text selection across the whole app while dragging a divider is pure\n // noise, and iframes/canvases would otherwise swallow the pointer.\n const previousSelect = document.body.style.userSelect\n const previousCursor = document.body.style.cursor\n document.body.style.userSelect = 'none'\n document.body.style.cursor = 'col-resize'\n return () => {\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', stop)\n window.removeEventListener('pointercancel', stop)\n document.body.style.userSelect = previousSelect\n document.body.style.cursor = previousCursor\n }\n }, [dragging, clamp])\n\n // Report only on release: firing per pointer frame would write to\n // localStorage ~60×/second for one gesture.\n React.useEffect(() => {\n if (dragging) return\n onWidthChange?.(width)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dragging])\n\n const nudge = (delta: number) => setWidth((current) => clamp(current + delta))\n\n return (\n // Sidebar tone always: the gutter and the divider sit in the shell's\n // chrome, next to the menu — painting them page-white put a bright strip\n // between the dark chrome and the rail, which read as a seam rather than\n // as space.\n <div className={cn('fz-viewport-h flex w-full overflow-hidden bg-sidebar', !frame && 'md:bg-background')}>\n <div className=\"min-w-0 flex-1\">{children}</div>\n\n {/* Divider — desktop only; on a phone the rail is a sheet over the app,\n and there is nothing to divide. */}\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={width}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={(event) => {\n event.preventDefault()\n setDragging(true)\n }}\n onDoubleClick={() => setWidth(clamp(defaultWidth))}\n onKeyDown={(event) => {\n // Keyboard resize: a pointer-only divider makes the split view\n // unusable for anyone not using a mouse.\n if (event.key === 'ArrowLeft') { event.preventDefault(); nudge(24) }\n else if (event.key === 'ArrowRight') { event.preventDefault(); nudge(-24) }\n else if (event.key === 'Home') { event.preventDefault(); setWidth(maxWidth) }\n else if (event.key === 'End') { event.preventDefault(); setWidth(minWidth) }\n }}\n className={cn(\n // Zero width: the divider USED to be a 4px gutter, which meant the\n // page and the rail could never touch — there was always a strip of\n // chrome between them. It now sits exactly on the seam the rail's own\n // left border draws, and lights that border up when you reach for it.\n 'group relative hidden w-0 shrink-0 cursor-col-resize focus-visible:outline-none',\n open && 'md:block',\n )}\n >\n {/* Invisible at rest: the seam is already drawn by the rail's border,\n and a second rule beside it is just a line to look at. */}\n <span\n className={cn(\n 'absolute inset-y-6 -left-px w-0.5 rounded-full bg-transparent transition-colors',\n 'group-hover:bg-primary/60 group-focus-visible:bg-primary',\n dragging && 'bg-primary',\n )}\n />\n {/* Hit area wider than the line: 1px is honest visually and hostile\n to aim for. */}\n <span className=\"absolute inset-y-0 -left-1.5 -right-1.5\" />\n </div>\n\n {/* Rendered once: two copies would mount the rail's contents twice. On a\n phone the box collapses to zero width and the rail positions itself\n `fixed` over the screen. The frame inset is padding HERE rather than\n margin on the rail — a full-height child plus vertical margins\n overflows its own box. */}\n <aside\n style={{ ['--fayz-rail-w' as string]: `${width}px` }}\n className={cn(\n 'w-0 shrink-0 overflow-hidden',\n // Animating WIDTH is what makes the app glide back instead of\n // snapping; skipped mid-drag so the divider stays glued to the cursor.\n !dragging && 'motion-safe:transition-[width] motion-safe:duration-200 motion-safe:ease-out',\n open && 'md:w-[var(--fayz-rail-w)]',\n frame && 'md:py-2 md:pr-2',\n )}\n >\n {rail}\n </aside>\n </div>\n )\n}\n"]}
|